Skip to content

Inclusive naming, part II #734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion builtin/fast-export.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ static void handle_tags_and_duplicates(struct string_list *extras)
/*
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the Git mailing list, Junio C Hamano wrote (reply to this):

"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> In an ongoing effort to avoid non-inclusive language, let's avoid using
> the branch name "master" in a code comment.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  builtin/fast-export.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/fast-export.c b/builtin/fast-export.c
> index 1b8fca3ee0..5527135ba8 100644
> --- a/builtin/fast-export.c
> +++ b/builtin/fast-export.c
> @@ -1026,7 +1026,7 @@ static void handle_tags_and_duplicates(struct string_list *extras)
>  				/*
>  				 * Getting here means we have a commit which
>  				 * was excluded by a negative refspec (e.g.
> -				 * fast-export ^master master).  If we are
> +				 * fast-export ^HEAD HEAD).  If we are

Obviously good change.  Thanks.

>  				 * referencing excluded commits, set the ref
>  				 * to the exact commit.  Otherwise, the user
>  				 * wants the branch exported but every commit

* Getting here means we have a commit which
* was excluded by a negative refspec (e.g.
* fast-export ^master master). If we are
* fast-export ^HEAD HEAD). If we are
* referencing excluded commits, set the ref
* to the exact commit. Otherwise, the user
* wants the branch exported but every commit
Expand Down
34 changes: 17 additions & 17 deletions t/t3200-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ test_expect_success 'git branch -M master master should work when master is chec
git branch -M master master
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the Git mailing list, Jeff King wrote (reply to this):

On Wed, Sep 16, 2020 at 06:10:51PM +0000, Johannes Schindelin via GitGitGadget wrote:

> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> 
> To avoid branch names with a loaded history, we already started to avoid
> using the name "master" in a couple instances.
> 
> The `t3200-branch.sh` script uses variations of this name for branches
> other than the default one. So let's change those names, as
> "lowest-hanging fruits" in the effort to use more inclusive naming
> throughout Git's source code.

A few of these are kind of odd after only this patch. E.g.:

> -test_expect_success 'git branch -M master2 master2 should work when master is checked out' '
> +test_expect_success 'git branch -M main2 main2 should work when master is checked out' '
>  	git checkout master &&
> -	git branch master2 &&
> -	git branch -M master2 master2
> +	git branch main2 &&
> +	git branch -M main2 main2
>  '

The point of "master2" is that it wasn't "master". But now "main2" is
kind of a weird name, because it has a "2" but isn't related to
anything. If we eventually move the base branch name to "main", they'll
line up again.

I'm on the fence on whether this matters. It's a temporary
inconsistency, assuming we eventually move to "main" as the default. We
_could_ push this change off to that patch, too, but it does make it
more noisy.

But it may be that the connection to "master" here is not all that
important in the first place. And so perhaps an even better patch (both
at this stage and in the long run) is to give it a more descriptive
name. If all of these could just be "branch2", "branch3", etc, then that
alone would be better than "master2", IMHO. I'm not sure if the shared
"ma" prefix matters, though (I know in some tests it does because we're
testing glob matching).

Again, I'm on the fence whether this is exploring too deeply. It's an
opportunity to improve the tests while we're changing them. But at the
same time, I doubt anybody cares too much overall, so it feels a bit
like make-work.

-Peff

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the Git mailing list, Junio C Hamano wrote (reply to this):

Jeff King <peff@peff.net> writes:

> I'm on the fence on whether this matters. It's a temporary
> inconsistency, assuming we eventually move to "main" as the default. We
> _could_ push this change off to that patch, too, but it does make it
> more noisy.

Another way to handle this is perhaps to teach test-lib.sh a way to
tell it that we want to live in the world where the initial default
branch name is 'main' and use that at the beginning of these select
test scripts like t3200.  Then we can do three related things in a
single patch to t3200, which are:

 - Declare that any "git init" in this test (including the initial
   one) uses 'main' as the default branch name;

 - rename 'master' used in the test to 'main'

 - rename 'master2' used in the test to 'main2'

and it would eliminate the awkwardness.

The change to test-lib.sh would likely to use init.defaultBranch
which also would be a good thing.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the Git mailing list, Jeff King wrote (reply to this):

On Wed, Sep 16, 2020 at 03:28:21PM -0700, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> > I'm on the fence on whether this matters. It's a temporary
> > inconsistency, assuming we eventually move to "main" as the default. We
> > _could_ push this change off to that patch, too, but it does make it
> > more noisy.
> 
> Another way to handle this is perhaps to teach test-lib.sh a way to
> tell it that we want to live in the world where the initial default
> branch name is 'main' and use that at the beginning of these select
> test scripts like t3200.  Then we can do three related things in a
> single patch to t3200, which are:
> 
>  - Declare that any "git init" in this test (including the initial
>    one) uses 'main' as the default branch name;
> 
>  - rename 'master' used in the test to 'main'
> 
>  - rename 'master2' used in the test to 'main2'
> 
> and it would eliminate the awkwardness.
> 
> The change to test-lib.sh would likely to use init.defaultBranch
> which also would be a good thing.

Yeah, I'd be perfectly happy with that.

-Peff

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the Git mailing list, Johannes Schindelin wrote (reply to this):

Hi Junio & Peff,

On Wed, 16 Sep 2020, Jeff King wrote:

> On Wed, Sep 16, 2020 at 03:28:21PM -0700, Junio C Hamano wrote:
>
> > Jeff King <peff@peff.net> writes:
> >
> > > I'm on the fence on whether this matters. It's a temporary
> > > inconsistency, assuming we eventually move to "main" as the default.
> > > We _could_ push this change off to that patch, too, but it does make
> > > it more noisy.
> >
> > Another way to handle this is perhaps to teach test-lib.sh a way to
> > tell it that we want to live in the world where the initial default
> > branch name is 'main' and use that at the beginning of these select
> > test scripts like t3200.  Then we can do three related things in a
> > single patch to t3200, which are:
> >
> >  - Declare that any "git init" in this test (including the initial
> >    one) uses 'main' as the default branch name;
> >
> >  - rename 'master' used in the test to 'main'
> >
> >  - rename 'master2' used in the test to 'main2'
> >
> > and it would eliminate the awkwardness.
> >
> > The change to test-lib.sh would likely to use init.defaultBranch
> > which also would be a good thing.
>
> Yeah, I'd be perfectly happy with that.

I do want to introduce something like that in the patch series after the
next one.

However, in this instance, I think it makes more sense to use a separate
name altogether. I settled for using `topic` instead of `main2`, and
`new-topic` instead of `main3` locally.

Ciao,
Dscho

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the Git mailing list, Junio C Hamano wrote (reply to this):

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> > Jeff King <peff@peff.net> writes:
>> >
>> > > I'm on the fence on whether this matters. It's a temporary
>> > > inconsistency, assuming we eventually move to "main" as the default.
>> > > We _could_ push this change off to that patch, too, but it does make
>> > > it more noisy.
>> > ...
> However, in this instance, I think it makes more sense to use a separate
> name altogether. I settled for using `topic` instead of `main2`, and
> `new-topic` instead of `main3` locally.

I think that is sensible.  Configuration does not have to be used as
an escape hatch to make 'main2' less awkward---if we can avoid
'main2' (or 'master2'), that would be sufficient.

'

test_expect_success 'git branch -M master2 master2 should work when master is checked out' '
test_expect_success 'git branch -M topic topic should work when master is checked out' '
git checkout master &&
git branch master2 &&
git branch -M master2 master2
git branch topic &&
git branch -M topic topic
'

test_expect_success 'git branch -v -d t should work' '
Expand Down Expand Up @@ -324,8 +324,8 @@ test_expect_success 'git branch --list -v with --abbrev' '
test_expect_success 'git branch --column' '
COLUMNS=81 git branch --column=column >actual &&
cat >expect <<\EOF &&
a/b/c bam foo l * master mb o/o q
abc bar j/k m/m master2 n o/p r
a/b/c bam foo l * master n o/p r
abc bar j/k m/m mb o/o q topic
EOF
test_cmp expect actual
'
Expand All @@ -346,13 +346,13 @@ test_expect_success 'git branch --column with an extremely long branch name' '
l
m/m
* master
master2
mb
n
o/o
o/p
q
r
topic
$long
EOF
test_cmp expect actual
Expand All @@ -365,8 +365,8 @@ test_expect_success 'git branch with column.*' '
git config --unset column.branch &&
git config --unset column.ui &&
cat >expect <<\EOF &&
a/b/c bam foo l * master mb o/o q
abc bar j/k m/m master2 n o/p r
a/b/c bam foo l * master n o/p r
abc bar j/k m/m mb o/o q topic
EOF
test_cmp expect actual
'
Expand All @@ -377,7 +377,7 @@ test_expect_success 'git branch --column -v should fail' '

test_expect_success 'git branch -v with column.ui ignored' '
git config column.ui column &&
COLUMNS=80 git branch -v | cut -c -10 | sed "s/ *$//" >actual &&
COLUMNS=80 git branch -v | cut -c -9 | sed "s/ *$//" >actual &&
git config --unset column.ui &&
cat >expect <<\EOF &&
a/b/c
Expand All @@ -389,13 +389,13 @@ test_expect_success 'git branch -v with column.ui ignored' '
l
m/m
* master
master2
mb
n
o/o
o/p
q
r
topic
EOF
test_cmp expect actual
'
Expand Down Expand Up @@ -597,10 +597,10 @@ test_expect_success 'git branch -C master master should work when master is chec
git branch -C master master
'

test_expect_success 'git branch -C master5 master5 should work when master is checked out' '
test_expect_success 'git branch -C main5 main5 should work when master is checked out' '
git checkout master &&
git branch master5 &&
git branch -C master5 master5
git branch main5 &&
git branch -C main5 main5
'

test_expect_success 'git branch -C ab cd should overwrite existing config for cd' '
Expand Down Expand Up @@ -711,11 +711,11 @@ test_expect_success 'deleting a self-referential symref' '
'

test_expect_success 'renaming a symref is not allowed' '
git symbolic-ref refs/heads/master2 refs/heads/master &&
test_must_fail git branch -m master2 master3 &&
git symbolic-ref refs/heads/master2 &&
git symbolic-ref refs/heads/topic refs/heads/master &&
test_must_fail git branch -m topic new-topic &&
git symbolic-ref refs/heads/topic &&
test_path_is_file .git/refs/heads/master &&
test_path_is_missing .git/refs/heads/master3
test_path_is_missing .git/refs/heads/new-topic
'

test_expect_success SYMLINKS 'git branch -m u v should fail when the reflog for u is a symlink' '
Expand Down
42 changes: 21 additions & 21 deletions t/t3427-rebase-subtree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ commit_message() {
# this test script tries to document them. First, the following commit history
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the Git mailing list, Junio C Hamano wrote (reply to this):

"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh
> index 79e43a370b..ba27e9d603 100755
> --- a/t/t3427-rebase-subtree.sh
> +++ b/t/t3427-rebase-subtree.sh
> @@ -15,12 +15,12 @@ commit_message() {
>  # this test script tries to document them.  First, the following commit history
>  # is generated (the onelines are shown, time flows from left to right):
>  #
> -# master1 - master2 - master3
> +# main1 - main2 - main3

The improvement between v1 and v2 made to t3200 (the previous step)
would equally apply here, no?  IOW, master1 didn't have to have a
name derived from master but could just have been called topic-1.
So replacing master[0-9] with topoic[0-9] may be more appropriate
here.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the Git mailing list, Johannes Schindelin wrote (reply to this):

Hi Junio,

On Mon, 21 Sep 2020, Junio C Hamano wrote:

> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
> > diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh
> > index 79e43a370b..ba27e9d603 100755
> > --- a/t/t3427-rebase-subtree.sh
> > +++ b/t/t3427-rebase-subtree.sh
> > @@ -15,12 +15,12 @@ commit_message() {
> >  # this test script tries to document them.  First, the following commit history
> >  # is generated (the onelines are shown, time flows from left to right):
> >  #
> > -# master1 - master2 - master3
> > +# main1 - main2 - main3
>
> The improvement between v1 and v2 made to t3200 (the previous step)
> would equally apply here, no?  IOW, master1 didn't have to have a
> name derived from master but could just have been called topic-1.
> So replacing master[0-9] with topoic[0-9] may be more appropriate
> here.

Indeed. It also has the benefit that `topic-` has exactly the same amount
of letters as `master`, therefore we need not worry about any ASCII art
that is modified (and might need realigning).

Thanks,
Dscho

# is generated (the onelines are shown, time flows from left to right):
#
# master1 - master2 - master3
# topic_1 - topic_2 - topic_3
# \
# README ---------------------- Add subproject master - master4 - files_subtree/master5
# README ---------------------- Add subproject master - topic_4 - files_subtree/topic_5
#
# Where the merge moves the files master[123].t into the subdirectory
# files_subtree/ and master4 as well as files_subtree/master5 add files to that
# files_subtree/ and topic_4 as well as files_subtree/topic_5 add files to that
# directory directly.
#
# Then, in subsequent test cases, `git filter-branch` is used to distill just
# the commits that touch files_subtree/. To give it a final pre-rebase touch,
# an empty commit is added on top. The pre-rebase commit history looks like
# this:
#
# Add subproject master - master4 - files_subtree/master5 - Empty commit
# Add subproject master - topic_4 - files_subtree/topic_5 - Empty commit
#
# where the root commit adds three files: master1.t, master2.t and master3.t.
# where the root commit adds three files: topic_1.t, topic_2.t and topic_3.t.
#
# This commit history is then rebased onto `master3` with the
# This commit history is then rebased onto `topic_3` with the
# `-Xsubtree=files_subtree` option in three different ways:
#
# 1. using `--preserve-merges`
Expand All @@ -43,9 +43,9 @@ test_expect_success 'setup' '
test_commit README &&
git init files &&
test_commit -C files master1 &&
test_commit -C files master2 &&
test_commit -C files master3 &&
test_commit -C files topic_1 &&
test_commit -C files topic_2 &&
test_commit -C files topic_3 &&
: perform subtree merge into files_subtree/ &&
git fetch files refs/heads/master:refs/heads/files-master &&
Expand All @@ -55,8 +55,8 @@ test_expect_success 'setup' '
git commit -m "Add subproject master" &&
: add two extra commits to rebase &&
test_commit -C files_subtree master4 &&
test_commit files_subtree/master5 &&
test_commit -C files_subtree topic_4 &&
test_commit files_subtree/topic_5 &&
git checkout -b to-rebase &&
git fast-export --no-data HEAD -- files_subtree/ |
Expand All @@ -66,22 +66,22 @@ test_expect_success 'setup' '
git commit -m "Empty commit" --allow-empty
'

# FAILURE: Does not preserve master4.
# FAILURE: Does not preserve topic_4.
test_expect_failure REBASE_P 'Rebase -Xsubtree --preserve-merges --onto commit' '
reset_rebase &&
git checkout -b rebase-preserve-merges to-rebase &&
git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master &&
verbose test "$(commit_message HEAD~)" = "master4" &&
verbose test "$(commit_message HEAD)" = "files_subtree/master5"
verbose test "$(commit_message HEAD~)" = "topic_4" &&
verbose test "$(commit_message HEAD)" = "files_subtree/topic_5"
'

# FAILURE: Does not preserve master4.
# FAILURE: Does not preserve topic_4.
test_expect_failure REBASE_P 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit' '
reset_rebase &&
git checkout -b rebase-keep-empty to-rebase &&
git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master &&
verbose test "$(commit_message HEAD~2)" = "master4" &&
verbose test "$(commit_message HEAD~)" = "files_subtree/master5" &&
verbose test "$(commit_message HEAD~2)" = "topic_4" &&
verbose test "$(commit_message HEAD~)" = "files_subtree/topic_5" &&
verbose test "$(commit_message HEAD)" = "Empty commit"
'

Expand All @@ -91,8 +91,8 @@ test_expect_success 'Rebase -Xsubtree --empty=ask --onto commit' '
test_must_fail git rebase -Xsubtree=files_subtree --empty=ask --onto files-master master &&
: first pick results in no changes &&
git rebase --skip &&
verbose test "$(commit_message HEAD~2)" = "master4" &&
verbose test "$(commit_message HEAD~)" = "files_subtree/master5" &&
verbose test "$(commit_message HEAD~2)" = "topic_4" &&
verbose test "$(commit_message HEAD~)" = "files_subtree/topic_5" &&
verbose test "$(commit_message HEAD)" = "Empty commit"
'

Expand All @@ -102,8 +102,8 @@ test_expect_success 'Rebase -Xsubtree --empty=ask --rebase-merges --onto commit'
test_must_fail git rebase -Xsubtree=files_subtree --empty=ask --rebase-merges --onto files-master --root &&
: first pick results in no changes &&
git rebase --skip &&
verbose test "$(commit_message HEAD~2)" = "master4" &&
verbose test "$(commit_message HEAD~)" = "files_subtree/master5" &&
verbose test "$(commit_message HEAD~2)" = "topic_4" &&
verbose test "$(commit_message HEAD~)" = "files_subtree/topic_5" &&
verbose test "$(commit_message HEAD)" = "Empty commit"
'

Expand Down
8 changes: 4 additions & 4 deletions t/t4150-am.sh
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ test_expect_success 'am changes committer and keeps author' '
test_expect_success 'am --signoff adds Signed-off-by: line' '
rm -fr .git/rebase-apply &&
git reset --hard &&
git checkout -b master2 first &&
git checkout -b topic_2 first &&
git am --signoff <patch2 &&
{
printf "third\n\nSigned-off-by: %s <%s>\n\n" \
Expand All @@ -479,7 +479,7 @@ test_expect_success 'am --signoff adds Signed-off-by: line' '
'

test_expect_success 'am stays in branch' '
echo refs/heads/master2 >expected &&
echo refs/heads/topic_2 >expected &&
git symbolic-ref HEAD >actual &&
test_cmp expected actual
'
Expand Down Expand Up @@ -540,7 +540,7 @@ test_expect_success 'am without --keep removes Re: and [PATCH] stuff' '
git reset --hard HEAD^ &&
git am <patch4 &&
git rev-parse HEAD >expected &&
git rev-parse master2 >actual &&
git rev-parse topic_2 >actual &&
test_cmp expected actual
'

Expand All @@ -567,7 +567,7 @@ test_expect_success 'am --keep-non-patch really keeps the non-patch part' '
test_expect_success 'setup am -3' '
rm -fr .git/rebase-apply &&
git reset --hard &&
git checkout -b base3way master2 &&
git checkout -b base3way topic_2 &&
sed -n -e "3,\$p" msg >file &&
head -n 9 msg >>file &&
git add file &&
Expand Down
6 changes: 3 additions & 3 deletions t/t5515-fetch-merge-logic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export GIT_TEST_PROTOCOL_VERSION

build_script () {
script="$1" &&
for i in one three_file master master2 one_tree three two two2 three2
for i in one three_file master topic_2 one_tree three two two2 three2
do
echo "s/$(test_oid --hash=sha1 "$i")/$(test_oid "$i")/g" >>"$script"
done
Expand Down Expand Up @@ -52,8 +52,8 @@ test_expect_success setup '
two sha1:525b7fb068d59950d185a8779dc957c77eed73ba
two sha256:3b21de3440cd38c2a9e9b464adb923f7054949ed4c918e1a0ac4c95cd52774db

master2 sha1:754b754407bf032e9a2f9d5a9ad05ca79a6b228f
master2 sha256:6c7abaea8a6d8ef4d89877e68462758dc6774690fbbbb0e6d7dd57415c9abde0
topic_2 sha1:754b754407bf032e9a2f9d5a9ad05ca79a6b228f
topic_2 sha256:6c7abaea8a6d8ef4d89877e68462758dc6774690fbbbb0e6d7dd57415c9abde0

two2 sha1:6134ee8f857693b96ff1cc98d3e2fd62b199e5a8
two2 sha256:87a2d3ee29c83a3dc7afd41c0606b11f67603120b910a7be7840accdc18344d4
Expand Down
20 changes: 10 additions & 10 deletions t/t5523-push-upstream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@ test_expect_success 'push -u --dry-run master:otherX' '
check_config master upstream refs/heads/other
'

test_expect_success 'push -u master2:master2' '
git branch master2 &&
git push -u upstream master2:master2 &&
check_config master2 upstream refs/heads/master2
test_expect_success 'push -u topic_2:topic_2' '
git branch topic_2 &&
git push -u upstream topic_2:topic_2 &&
check_config topic_2 upstream refs/heads/topic_2
'

test_expect_success 'push -u master2:other2' '
git push -u upstream master2:other2 &&
check_config master2 upstream refs/heads/other2
test_expect_success 'push -u topic_2:other2' '
git push -u upstream topic_2:other2 &&
check_config topic_2 upstream refs/heads/other2
'

test_expect_success 'push -u :master2' '
git push -u upstream :master2 &&
check_config master2 upstream refs/heads/other2
test_expect_success 'push -u :topic_2' '
git push -u upstream :topic_2 &&
check_config topic_2 upstream refs/heads/other2
'

test_expect_success 'push -u --all' '
Expand Down
6 changes: 3 additions & 3 deletions t/t6018-rev-list-glob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ test_expect_success 'setup' '
git checkout -b someref master &&
commit some &&
git checkout master &&
commit master2 &&
commit topic_2 &&
git tag foo/bar master &&
commit master3 &&
commit topic_3 &&
git update-ref refs/remotes/foo/baz master &&
commit master4 &&
commit topic_4 &&
git update-ref refs/remotes/upstream/one subspace/one &&
git update-ref refs/remotes/upstream/two subspace/two &&
git update-ref refs/remotes/upstream/x subspace-x &&
Expand Down
20 changes: 10 additions & 10 deletions t/t6040-tracking-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -264,25 +264,25 @@ test_expect_success 'fail to track annotated tags' '
test_expect_success '--set-upstream-to does not change branch' '
git branch from-master master &&
git branch --set-upstream-to master from-master &&
git branch from-master2 master &&
test_must_fail git config branch.from-master2.merge > actual &&
git rev-list from-master2 &&
git update-ref refs/heads/from-master2 from-master2^ &&
git rev-parse from-master2 >expect2 &&
git branch --set-upstream-to master from-master2 &&
git branch from-topic_2 master &&
test_must_fail git config branch.from-topic_2.merge > actual &&
git rev-list from-topic_2 &&
git update-ref refs/heads/from-topic_2 from-topic_2^ &&
git rev-parse from-topic_2 >expect2 &&
git branch --set-upstream-to master from-topic_2 &&
git config branch.from-master.merge > actual &&
git rev-parse from-master2 >actual2 &&
git rev-parse from-topic_2 >actual2 &&
grep -q "^refs/heads/master$" actual &&
cmp expect2 actual2
'

test_expect_success '--set-upstream-to @{-1}' '
git checkout follower &&
git checkout from-master2 &&
git config branch.from-master2.merge > expect2 &&
git checkout from-topic_2 &&
git config branch.from-topic_2.merge > expect2 &&
git branch --set-upstream-to @{-1} from-master &&
git config branch.from-master.merge > actual &&
git config branch.from-master2.merge > actual2 &&
git config branch.from-topic_2.merge > actual2 &&
git branch --set-upstream-to follower from-master &&
git config branch.from-master.merge > expect &&
test_cmp expect2 actual2 &&
Expand Down
Loading