Обсуждение: https://wiki.postgresql.org/wiki/Working_with_Git link one link cannot open, another link is unrelated.

Поиск
Список
Период
Сортировка


Hi. It's more like a git question less like a postgres question..
I executed the following commands

rm /home/jian/Downloads/001_psql_parse_only_test.patch
git checkout master
git branch --delete --force feature_to_review
git  checkout -b feature_to_review
patch -p1 --batch < /home/jian/Downloads/001_psql_parse_only.v1.patch
git commit -a -m "test"
git diff --patience master feature_to_review > /home/jian/Downloads/001_psql_parse_only_test.patch
git diff --color-words --no-index /home/jian/Downloads/001_psql_parse_only.v1.patch  /home/jian/Downloads/001_psql_parse_only_test.patch

the last command should return nothing? The idea is to create a local branch, patch the downloaded patch file, and commit the patch file.
Then try to use git diff to validate local branch = master + patch file by comparing the download patch file with the output of (git diff branchA branchB).
Generally what's the correct commands (workflow to patch the patch file) and how can i validate the local branch only has the patched file changes and no others.


See the documentation and tutorials at http://git.or.cz/ for a more detailed Git introduction. For a more detailed lesson, check out http://progit.org and maybe get a hardcopy to help support the site.
the first link not working, the second link, is not that related to git.

Hi,

jian he <jian.universality@gmail.com>, 28 Ara 2022 Çar, 13:01 tarihinde şunu yazdı:
the last command should return nothing?

No, a patch file is not the same with diff output. Patches in the mailing list mostly include some meta information like commit message, commit date, author name etc. in addition to diff.
That's why git diff will probably find differences between a patch downloaded from the mailing list and your patch created by git diff.
If differences are only in meta info, stats, indexes etc.and not code itself, then it should be good.

You may use "git format-patch" to create a patch with similar format to the ones from the mailing list. But it wouldn't be exactly the same since dates, commit messages etc will be different.
 
The idea is to create a local branch, patch the downloaded patch file, and commit the patch file.
Then try to use git diff to validate local branch = master + patch file by comparing the download patch file with the output of (git diff branchA branchB).
Generally what's the correct commands (workflow to patch the patch file) and how can i validate the local branch only has the patched file changes and no others.

Alternatively, you can use "git am <patch_name>" to add the patch as a new commit to your current branch. Then you'll have master + patch.

See the documentation and tutorials at http://git.or.cz/ for a more detailed Git introduction. For a more detailed lesson, check out http://progit.org and maybe get a hardcopy to help support the site.
the first link not working, the second link, is not that related to git.

This is just bad. Needs to be updated properly.

Best, 
--
Melih Mutlu
Microsoft
On 2022-Dec-29, Melih Mutlu wrote:

> also in this link: https://wiki.postgresql.org/wiki/Working_with_Git
> >
> >> See the documentation and tutorials at http://git.or.cz/ for a more
> >> detailed Git introduction. For a more detailed lesson, check out
> >> http://progit.org and maybe get a hardcopy to help support the site.
> >>
> > the first link not working, the second link, is not that related to git.
>
> This is just bad. Needs to be updated properly.

I have fixed the outdated links now.  There are several other things in
those instructions that seem dated -- perhaps not factually wrong, but
they look odd in 2023.

(Hmm, one thing that does seem wrong is that we no longer offer
individual repos under git.postgresql.org; AFAIR we tell people to rely
on external providers such as github/gitlab for that.)

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
Thou shalt study thy libraries and strive not to reinvent them without
cause, that thy code may be short and readable and thy days pleasant
and productive. (7th Commandment for C Programmers)