threads / discuss / 63770

git-subtree documentation fix request: split example causes fatal error

Subject: git-subtree documentation fix request: split example causes fatal error

## tl;dr

2 messages between Jul 9, 2025 and Jul 9, 2025.

replies: 1people: 2as markdown or json

Alexander Krupp· Jul 9, 2025, 11:01 UTC · lore

Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
Read the documentation on git-subtree and try it:
 > git clone git://git.kernel.org/pub/scm/git/git.git test-git
Cloning into 'test-git'...
remote: Enumerating objects: 392367, done.
remote: Counting objects: 100% (7710/7710), done.
remote: Compressing objects: 100% (1126/1126), done.
remote: Total 392367 (delta 7015), reused 7002 (delta 6575), pack-reused 
384657
Receiving objects: 100% (392367/392367), 131.92 MiB | 49.57 MiB/s, done.
Resolving deltas: 100% (296075/296075), done.
 > cd test-git/
 > git subtree split --prefix=gitweb --annotate='(split) ' \
 >                      0a8f4f0^.. --onto=1130ef3 --rejoin \
 >                      --branch gitweb-latest
fatal: '0a8f4f0^..' does not refer to a commit
 >
What did you expect to happen? (Expected behavior)
Example should work as documented.
What happened instead? (Actual behavior)
see above.
What's different between what you expected and what actually happened?
Anything else you want to add:

Recommend a fix of the documentation. Due to lack of experience with subtree I cannot provide.

Please review the rest of the bug report below. You can delete any lines you don't wish to share.

[System Info] git version: git version 2.43.0 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 6.4.0-150600.23.50-default #1 SMP PREEMPT_DYNAMIC Fri May  9 22:09:52 UTC 2025 (dee422c) x86_64 compiler info: gnuc: 7.5 libc info: glibc: 2.38 $SHELL (typically, interactive shell): /bin/bash

[Enabled Hooks]

Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
Read the documentation on git-subtree and try it:
> git clone git://git.kernel.org/pub/scm/git/git.git test-git

Cloning into 'test-git'... remote: Enumerating objects: 392367, done. remote: Counting objects: 100% (7710/7710), done. remote: Compressing objects: 100% (1126/1126), done. remote: Total 392367 (delta 7015), reused 7002 (delta 6575), pack-reused 384657 Receiving objects: 100% (392367/392367), 131.92 MiB | 49.57 MiB/s, done. Resolving deltas: 100% (296075/296075), done.

> cd test-git/
> git subtree split --prefix=gitweb --annotate='(split) ' \
>                      0a8f4f0^.. --onto=1130ef3 --rejoin \
>                      --branch gitweb-latest
fatal: '0a8f4f0^..' does not refer to a commit
>
What did you expect to happen? (Expected behavior)
Example should work as documented.
What happened instead? (Actual behavior)
see above.
What's different between what you expected and what actually happened?
Anything else you want to add:
Recommend a fix of the documentation. Due to lack of experience with subtree I cannot provide.

Please review the rest of the bug report below. You can delete any lines you don't wish to share.

[System Info] git version: git version 2.43.0 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 6.4.0-150600.23.50-default #1 SMP PREEMPT_DYNAMIC Fri May 9 22:09:52 UTC 2025 (dee422c) x86_64 compiler info: gnuc: 7.5 libc info: glibc: 2.38 $SHELL (typically, interactive shell): /bin/bash

[Enabled Hooks]
Marc Branchaud· Jul 9, 2025, 16:33 UTC · re: Alexander Krupp · lore

Re: git-subtree documentation fix request: split example causes fatal error

On 2025-07-09 07:01, Alexander Krupp wrote:
Show 22 quoted lines
> Thank you for filling out a Git bug report!
> Please answer the following questions to help us understand your issue.
> 
> What did you do before the bug happened? (Steps to reproduce your issue)
> 
> Read the documentation on git-subtree and try it:
> 
>  > git clone git://git.kernel.org/pub/scm/git/git.git test-git
> Cloning into 'test-git'...
> remote: Enumerating objects: 392367, done.
> remote: Counting objects: 100% (7710/7710), done.
> remote: Compressing objects: 100% (1126/1126), done.
> remote: Total 392367 (delta 7015), reused 7002 (delta 6575), pack-reused 
> 384657
> Receiving objects: 100% (392367/392367), 131.92 MiB | 49.57 MiB/s, done.
> Resolving deltas: 100% (296075/296075), done.
>  > cd test-git/
>  > git subtree split --prefix=gitweb --annotate='(split) ' \
>  >                      0a8f4f0^.. --onto=1130ef3 --rejoin \
>  >                      --branch gitweb-latest
> fatal: '0a8f4f0^..' does not refer to a commit
>  >

Thanks for reporting this! I also just ran into it when following subtree's documentation.

The problem stems from this:
	git rev-parse -q --verify "$1^{commit}" >/dev/null ||
		die "fatal: '$1' does not refer to a commit"
Here, $1 is the "0a8f4f0^.." part.

I then tried removing the "..", which lets the command run but then I ended up with an empty result. Not sure why that happens, though.

I've CC'd subtree's author, Avery (as identified in contrib/subtree/README), and David, who added this check long ago (commit 10a49587fab).

		M.
Show 35 quoted lines
> What did you expect to happen? (Expected behavior)
> 
> Example should work as documented.
> 
> What happened instead? (Actual behavior)
> 
> see above.
> 
> What's different between what you expected and what actually happened?
> 
> Anything else you want to add:
> 
> Recommend a fix of the documentation. Due to lack of experience with 
> subtree I cannot provide.
> 
> Please review the rest of the bug report below.
> You can delete any lines you don't wish to share.
> 
> 
> [System Info]
> git version:
> git version 2.43.0
> cpu: x86_64
> no commit associated with this build
> sizeof-long: 8
> sizeof-size_t: 8
> shell-path: /bin/sh
> uname: Linux 6.4.0-150600.23.50-default #1 SMP PREEMPT_DYNAMIC Fri May 9 
> 22:09:52 UTC 2025 (dee422c) x86_64
> compiler info: gnuc: 7.5
> libc info: glibc: 2.38
> $SHELL (typically, interactive shell): /bin/bash
> 
> 
> [Enabled Hooks]

← back to recent threads