요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
Creating Pull Requests
======================
This chapter describes how maintainers can create and submit pull requests
to other maintainers. This is useful for transferring changes from one
maintainers tree to another maintainers tree.
This document was written by Tobin C. Harding (who at that time, was not an
experienced maintainer) primarily from comments made by Greg Kroah-Hartman
and Linus Torvalds on LKML. Suggestions and fixes by Jonathan Corbet and
Mauro Carvalho Chehab. Misrepresentation was unintentional but inevitable,
please direct abuse to Tobin C. Harding <[email protected]>.
Original email thread::
https://lore.kernel.org/r/[email protected]
Create Branch
-------------
To start with you will need to have all the changes you wish to include in
the pull request on a separate branch. Typically you will base this branch
off of a branch in the developers tree whom you intend to send the pull
request to.
In order to create the pull request you must first tag the branch that you
have just created. It is recommended that you choose a meaningful tag name,
in a way that you and others can understand, even after some time. A good
practice is to include in the name an indicator of the subsystem of origin
and the target kernel version.
Greg offers the following. A pull request with miscellaneous stuff for
drivers/char, to be applied at the Kernel version 4.15-rc1 could be named
as ``char-misc-4.15-rc1``. If such tag would be produced from a branch
named ``char-misc-next``, you would be using the following command::
git tag -s char-misc-4.15-rc1 char-misc-next
that will create a signed tag called ``char-misc-4.15-rc1`` based on the
last commit in the ``char-misc-next`` branch, and sign it with your gpg key
(see Documentation/maintainer/configure-git.rst).
Linus will only accept pull requests based on a signed tag. Other
maintainers may differ.
When you run the above command ``git`` will drop you into an editor and ask
you to describe the tag. In this case, you are describing a pull request,
so outline what is contained here, why it should be merged, and what, if
any, testing has been done. All of this information will end up in the tag
itself, and then in the merge commit that the maintainer makes if/when they
merge the pull request. So write it up well, as it will be in the kernel
tree forever.
As said by Linus::
Anyway, at least to me, the important part is the *message*. I want
to understand what I'm pulling, and why I should pull it. I also
want to use that message as the message for the merge, so it should
not just make sense to me, but make sense as a historical record
too.
Note that if there is something odd about the pull request, that
should very much be in the explanation. If you're touching files
that you don't maintain, explain _why_. I will see it in the
diffstat anyway, and if you didn't mention it, I'll just be extra
suspicious. And when you send me new stuff after the merge window
(or even bug-fixes, but ones that look scary), explain not just
what they do and why they do it, but explain the _timing_. What
happened that this didn't go through the merge window..
I will take both what you write in the email pull request _and_ in
the signed tag, so depending on your workflow, you can either
describe your work in the signed tag (which will also automatically
make it into the pull request email), or you can make the signed
tag just a placeholder with nothing interesting in it, and describe
the work later when you actually send me the pull request.
And yes, I will edit the message. Partly because I tend to do just
trivial formatting (the whole indentation and quoting etc), but
partly because part of the message may make sense for me at pull
time (describing the conflicts and your personal issues for sending
it right now), but may not make sense in the context of a merge
commit message, so I will try to make it all make sense. I will
also fix any speeling mistaeks and bad grammar I notice,
particularly for non-native speakers (but also for native ones
;^). But I may miss some, or even add some.
Linus
Greg gives, as an example pull request::
Char/Misc patches for 4.15-rc1
Here is the big char/misc patch set for the 4.15-rc1 merge window.
Contained in here is the normal set of new functions added to all
of these crazy drivers, as well as the following brand new
subsystems:
- time_travel_controller: Finally a set of drivers for the
latest time travel bus architecture that provides i/o to
the CPU before it asked for it, allowing uninterrupted
processing
- relativity_shifters: due to the affect that the
time_travel_controllers have on the overall system, there
was a need for a new set of relativity shifter drivers to
accommodate the newly formed black holes that would
threaten to suck CPUs into them. This subsystem handles
this in a way to successfully neutralize the problems.
There is a Kconfig option to force these to be enabled
when needed, so problems should not occur.
All of these patches have been successfully tested in the latest
linux-next releases, and the original problems that it found have
all been resolved (apologies to anyone living near Canberra for the
lack of the Kconfig options in the earlier versions of the
linux-next tree creations.)
Signed-off-by: Your-name-here <your_email@domain>
The tag message format is just like a git commit id. One line at the top
for a "summary subject" and be sure to sign-off at the bottom.
Now that you have a local signed tag, you need to push it up to where it
can be retrieved::
git push origin char-misc-4.15-rc1
Create Pull Request
-------------------
The last thing to do is create the pull request message. ``git`` handily
will do this for you with the ``git request-pull`` command, but it needs a
bit of help determining what you want to pull, and on what to base the pull
against (to show the correct changes to be pulled and the diffstat). The
following command(s) will generate a pull request::
git request-pull master git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/ char-misc-4.15-rc1
Quoting Greg::
This is asking git to compare the difference from the
'char-misc-4.15-rc1' tag location, to the head of the 'master'
branch (which in my case points to the last location in Linus's
tree that I diverged from, usually a -rc release) and to use the
git:// protocol to pull from. If you wish to use https://, that
can be used here instead as well (but note that some people behind
firewalls will have problems with https git pulls).
If the char-misc-4.15-rc1 tag is not present in the repo that I am
asking to be pulled from, git will complain saying it is not there,
a handy way to remember to actually push it to a public location.
The output of 'git request-pull' will contain the location of the
git tree and specific tag to pull from, and the full text
description of that tag (which is why you need to provide good
information in that tag). It will also create a diffstat of the
pull request, and a shortlog of the individual commits that the
pull request will provide.
Linus responded that he tends to prefer the ``git://`` protocol. Other
maintainers may have different preferences. Also, note that if you are
creating pull requests without a signed tag then ``https://`` may be a
better choice. Please see the original thread for the full discussion.
Submit Pull Request
-------------------
A pull request is submitted in the same way as an ordinary patch. Send as
inline email to the maintainer and CC LKML and any sub-system specific
lists if required. Pull requests to Linus typically have a subject line
something like::
[GIT PULL] <subsystem> changes for v4.15-rc1
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Pull request 작성 개요
1-18이 장은 maintainer가 자신의 tree에서 다른 maintainer의 tree로 변경을 전달하기 위한 pull request를 만들고 제출하는 방법을 설명합니다.
문서는 당시 경험이 많지 않았던 maintainer Tobin C. Harding이 Greg Kroah-Hartman과 Linus Torvalds의 LKML 의견을 중심으로 작성했고, Jonathan Corbet과 Mauro Carvalho Chehab가 제안과 수정을 제공했습니다.
원본 email thread는 `https://lore.kernel.org/r/[email protected]`에서 확인할 수 있습니다.
변경 branch 준비부터 inline email 제출까지의 흐름입니다.
Creating Pull Requests
======================
This chapter describes how maintainers can create and submit pull requests
to other maintainers. This is useful for transferring changes from one
maintainers tree to another maintainers tree.
This document was written by Tobin C. Harding (who at that time, was not an
experienced maintainer) primarily from comments made by Greg Kroah-Hartman
and Linus Torvalds on LKML. Suggestions and fixes by Jonathan Corbet and
Mauro Carvalho Chehab. Misrepresentation was unintentional but inevitable,
please direct abuse to Tobin C. Harding <[email protected]>.
Original email thread::
https://lore.kernel.org/r/[email protected]
Branch와 signed tag 생성
19-54Pull request에 포함할 모든 변경은 별도 branch에 모아야 합니다. 보통 요청을 받을 개발자의 tree에 있는 branch를 base로 삼습니다.
Pull request를 만들기 전에 이 branch에 tag를 붙입니다. 시간이 지난 뒤에도 의미를 알 수 있도록 subsystem 출처와 target kernel version을 포함한 이름을 권장합니다.
예를 들어 `drivers/char`의 miscellaneous 변경을 kernel `4.15-rc1`에 적용하려면 tag를 `char-misc-4.15-rc1`이라고 할 수 있습니다. `char-misc-next` branch tip을 대상으로 `git tag -s char-misc-4.15-rc1 char-misc-next`를 실행합니다.
이 명령은 `char-misc-next`의 마지막 commit을 가리키는 signed tag를 만들고 GPG key로 서명합니다. Key 설정은 `Documentation/maintainer/configure-git.rst`를 참고합니다. Linus는 signed tag 기반 pull request만 받지만 다른 maintainer의 정책은 다를 수 있습니다.
Git이 editor를 열면 tag 설명에 무엇이 들어 있는지, 왜 merge해야 하는지, 어떤 test를 수행했는지 적습니다. 이 정보는 tag 자체와 수신 maintainer가 만드는 merge commit에 들어가 kernel tree의 영구 기록이 되므로 충실히 작성해야 합니다.
수신 tree의 base와 전달 tip을 고정한 뒤 서명합니다.
이름만 보고도 출처와 목표 release를 알 수 있게 합니다.
Create Branch
-------------
To start with you will need to have all the changes you wish to include in
the pull request on a separate branch. Typically you will base this branch
off of a branch in the developers tree whom you intend to send the pull
request to.
In order to create the pull request you must first tag the branch that you
have just created. It is recommended that you choose a meaningful tag name,
in a way that you and others can understand, even after some time. A good
practice is to include in the name an indicator of the subsystem of origin
and the target kernel version.
Greg offers the following. A pull request with miscellaneous stuff for
drivers/char, to be applied at the Kernel version 4.15-rc1 could be named
as ``char-misc-4.15-rc1``. If such tag would be produced from a branch
named ``char-misc-next``, you would be using the following command::
git tag -s char-misc-4.15-rc1 char-misc-next
that will create a signed tag called ``char-misc-4.15-rc1`` based on the
last commit in the ``char-misc-next`` branch, and sign it with your gpg key
(see Documentation/maintainer/configure-git.rst).
Linus will only accept pull requests based on a signed tag. Other
maintainers may differ.
When you run the above command ``git`` will drop you into an editor and ask
you to describe the tag. In this case, you are describing a pull request,
so outline what is contained here, why it should be merged, and what, if
any, testing has been done. All of this information will end up in the tag
itself, and then in the merge commit that the maintainer makes if/when they
merge the pull request. So write it up well, as it will be in the kernel
tree forever.
좋은 tag message
55-120Linus가 강조하는 핵심은 message입니다. 수신자는 무엇을 pull하는지와 왜 pull해야 하는지 이해해야 하며, message는 merge commit의 역사적 기록으로도 자연스러워야 합니다.
유지보수하지 않는 file을 건드리는 것처럼 이상한 점이 있으면 이유를 설명해야 합니다. Diffstat에서 결국 보이므로 설명하지 않으면 오히려 의심을 키웁니다.
Merge window 뒤에 새 기능을 보내거나 겉보기에 위험한 bug fix를 보내는 경우에는 무엇을 왜 하는지뿐 아니라 timing도 설명해야 합니다. 왜 merge window를 통과하지 못했는지 기록합니다.
수신 maintainer는 email pull request와 signed tag의 내용을 모두 사용합니다. Workflow에 따라 signed tag에 상세 설명을 넣어 email에 자동 포함시키거나, tag는 간단히 두고 실제 요청 email에서 설명할 수 있습니다.
Merge하는 maintainer는 formatting을 정리하고, pull 시점에만 의미가 있는 conflict나 개인 사정을 merge commit 문맥에 맞게 편집하며, spelling과 grammar를 고칠 수 있습니다.
Greg의 예시는 `Char/Misc patches for 4.15-rc1`이라는 한 줄 summary 뒤에 patchset의 범위, 새 subsystem, linux-next test 결과와 해결된 문제를 설명하고 마지막에 `Signed-off-by`를 둡니다.
수신 판단과 장기 history 양쪽에 필요한 내용을 담습니다.
As said by Linus::
Anyway, at least to me, the important part is the *message*. I want
to understand what I'm pulling, and why I should pull it. I also
want to use that message as the message for the merge, so it should
not just make sense to me, but make sense as a historical record
too.
Note that if there is something odd about the pull request, that
should very much be in the explanation. If you're touching files
that you don't maintain, explain _why_. I will see it in the
diffstat anyway, and if you didn't mention it, I'll just be extra
suspicious. And when you send me new stuff after the merge window
(or even bug-fixes, but ones that look scary), explain not just
what they do and why they do it, but explain the _timing_. What
happened that this didn't go through the merge window..
I will take both what you write in the email pull request _and_ in
the signed tag, so depending on your workflow, you can either
describe your work in the signed tag (which will also automatically
make it into the pull request email), or you can make the signed
tag just a placeholder with nothing interesting in it, and describe
the work later when you actually send me the pull request.
And yes, I will edit the message. Partly because I tend to do just
trivial formatting (the whole indentation and quoting etc), but
partly because part of the message may make sense for me at pull
time (describing the conflicts and your personal issues for sending
it right now), but may not make sense in the context of a merge
commit message, so I will try to make it all make sense. I will
also fix any speeling mistaeks and bad grammar I notice,
particularly for non-native speakers (but also for native ones
;^). But I may miss some, or even add some.
Linus
Greg gives, as an example pull request::
Char/Misc patches for 4.15-rc1
Here is the big char/misc patch set for the 4.15-rc1 merge window.
Contained in here is the normal set of new functions added to all
of these crazy drivers, as well as the following brand new
subsystems:
- time_travel_controller: Finally a set of drivers for the
latest time travel bus architecture that provides i/o to
the CPU before it asked for it, allowing uninterrupted
processing
- relativity_shifters: due to the affect that the
time_travel_controllers have on the overall system, there
was a need for a new set of relativity shifter drivers to
accommodate the newly formed black holes that would
threaten to suck CPUs into them. This subsystem handles
this in a way to successfully neutralize the problems.
There is a Kconfig option to force these to be enabled
when needed, so problems should not occur.
All of these patches have been successfully tested in the latest
linux-next releases, and the original problems that it found have
all been resolved (apologies to anyone living near Canberra for the
lack of the Kconfig options in the earlier versions of the
linux-next tree creations.)
Signed-off-by: Your-name-here <your_email@domain>
Tag 형식과 remote push
121-129Tag message 형식은 Git commit message와 같습니다. 맨 위에 한 줄 summary subject를 쓰고 아래 본문을 작성한 뒤 마지막에 sign-off를 넣습니다.
Local signed tag가 준비되면 수신자가 가져갈 수 있는 remote에 push해야 합니다. 예시는 `git push origin char-misc-4.15-rc1`입니다.
Local 서명 결과를 pull 가능한 remote reference로 만듭니다.
The tag message format is just like a git commit id. One line at the top
for a "summary subject" and be sure to sign-off at the bottom.
Now that you have a local signed tag, you need to push it up to where it
can be retrieved::
git push origin char-misc-4.15-rc1
`git request-pull`로 요청 생성
130-167마지막 준비는 pull request message 생성입니다. `git request-pull`은 무엇을 pull할지와 어떤 base를 기준으로 비교할지 알아야 올바른 변경 목록과 diffstat을 만들 수 있습니다.
예시 명령은 `git request-pull master git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/ char-misc-4.15-rc1`입니다. `master`는 maintainer가 Linus tree에서 갈라진 마지막 지점, 보통 `-rc` release를 가리키고, 마지막 인자는 pull할 signed tag입니다.
Tag가 요청한 public repository에 없으면 Git이 오류를 내므로 tag push를 빠뜨렸다는 사실도 확인할 수 있습니다.
출력에는 Git tree 위치와 특정 tag, tag의 전체 설명, pull request diffstat, 포함되는 individual commit shortlog가 들어갑니다. 좋은 tag 설명이 필요한 이유가 여기서도 드러납니다.
Linus는 `git://` protocol을 선호한다고 답했지만 maintainer마다 preference가 다를 수 있습니다. Signed tag 없이 pull request를 만든다면 `https://`가 더 나을 수 있으며, firewall 환경의 protocol 제약도 고려해야 합니다.
Base, public repository, signed tag 세 입력으로 요청 본문을 생성합니다.
수신 maintainer 정책과 서명 방식, network 환경을 확인합니다.
Create Pull Request
-------------------
The last thing to do is create the pull request message. ``git`` handily
will do this for you with the ``git request-pull`` command, but it needs a
bit of help determining what you want to pull, and on what to base the pull
against (to show the correct changes to be pulled and the diffstat). The
following command(s) will generate a pull request::
git request-pull master git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/ char-misc-4.15-rc1
Quoting Greg::
This is asking git to compare the difference from the
'char-misc-4.15-rc1' tag location, to the head of the 'master'
branch (which in my case points to the last location in Linus's
tree that I diverged from, usually a -rc release) and to use the
git:// protocol to pull from. If you wish to use https://, that
can be used here instead as well (but note that some people behind
firewalls will have problems with https git pulls).
If the char-misc-4.15-rc1 tag is not present in the repo that I am
asking to be pulled from, git will complain saying it is not there,
a handy way to remember to actually push it to a public location.
The output of 'git request-pull' will contain the location of the
git tree and specific tag to pull from, and the full text
description of that tag (which is why you need to provide good
information in that tag). It will also create a diffstat of the
pull request, and a shortlog of the individual commits that the
pull request will provide.
Linus responded that he tends to prefer the ``git://`` protocol. Other
maintainers may have different preferences. Also, note that if you are
creating pull requests without a signed tag then ``https://`` may be a
better choice. Please see the original thread for the full discussion.
Pull request 제출
168-176Pull request는 일반 patch와 같은 방식으로 제출합니다. Maintainer에게 inline email로 보내고, 필요하면 LKML과 subsystem별 mailing list를 CC합니다.
Linus에게 보내는 요청의 subject는 보통 `[GIT PULL] <subsystem> changes for v4.15-rc1` 같은 형식입니다. 수신자가 list에서 요청 종류, subsystem, target release를 바로 식별할 수 있게 합니다.
Pull request도 공개 patch workflow 안에서 전달합니다.
Submit Pull Request
-------------------
A pull request is submitted in the same way as an ordinary patch. Send as
inline email to the maintainer and CC LKML and any sub-system specific
lists if required. Pull requests to Linus typically have a subject line
something like::
[GIT PULL] <subsystem> changes for v4.15-rc1
요약·해설
pull-requests.rst:1-176Pull request에는 수신 tree를 base로 한 별도 branch, 의미 있는 signed tag, 내용·merge 이유·test 결과를 담은 영구 기록용 message가 필요합니다.
Tag를 public remote에 push한 뒤 base·repository URL·tag를 `git request-pull`에 넘겨 diffstat과 shortlog를 생성합니다.
완성된 요청은 일반 patch처럼 maintainer와 필요한 mailing list에 inline email로 제출합니다.