threads / discuss / 56646

Git push subtree fail unknown revision or path possibly due to missing git-subtree-split commit

Subject: Git push subtree fail unknown revision or path possibly due to missing git-subtree-split commit

## tl;dr

4 messages between Oct 5, 2021 and Oct 8, 2021.

replies: 3people: 2as markdown or json

Eddie Ridwan· Oct 5, 2021, 04:53 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) git pull/push subtree as normal, although it is possible that one of the contributors to the subtree repo may have done a force push.

What did you expect to happen? (Expected behavior) git push subtree to update the remote subtree repo.

What happened instead? (Actual behavior) Failed to update the remote subtree repo. Error message:

       fatal: ambiguous argument
'3f44cc87ceb87df1d9171096596a824fc3050a27^{commit}': unknown revision
or path not in the working tree.
    Use '--' to separate paths from revisions, like this:
    'git <command> [<revision>...] -- [<file>...]'
    could not rev-parse split hash
3f44cc87ceb87df1d9171096596a824fc3050a27 from commit
8577911bf6183497cc246aa620e7be1b6becec29
What's different between what you expected and what actually happened?
Failed to update the subtree repo, as expected;
Anything else you want to add:

I am not able to find the commit/hash 3f44cc87ceb87df1d9171096596a824fc3050a27 in the repo. In gitx, I can see that the commit is a git-subtree-split. But it appears to no longer exist in the repo.

How can I bypass or recover from this apparent missing commit? Any help would be greatly appreciated.

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.33.0 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Darwin 19.6.0 Darwin Kernel Version 19.6.0: Tue Jun 22 19:49:55 PDT 2021; root:xnu-6153.141.35~1/RELEASE_X86_64 x86_64 compiler info: clang: 12.0.0 (clang-1200.0.32.29) libc info: no libc information available $SHELL (typically, interactive shell): /bin/bash

[Enabled Hooks]
Philippe Blain· Oct 7, 2021, 02:52 UTC · re: Eddie Ridwan · lore

Re: Git push subtree fail unknown revision or path possibly due to missing git-subtree-split commit

Hi Eddie,
Le 2021-10-05 à 00:53, Eddie Ridwan a écrit :
Show 6 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)
> git pull/push subtree as normal, although it is possible that one of
> the contributors to the subtree repo may have done a force push.
I think that is indeed what happened (see below).
Show 15 quoted lines
> 
> What did you expect to happen? (Expected behavior)
> git push subtree to update the remote subtree repo.
> 
> What happened instead? (Actual behavior)
> Failed to update the remote subtree repo. Error message:
> 
>         fatal: ambiguous argument
> '3f44cc87ceb87df1d9171096596a824fc3050a27^{commit}': unknown revision
> or path not in the working tree.
>      Use '--' to separate paths from revisions, like this:
>      'git <command> [<revision>...] -- [<file>...]'
>      could not rev-parse split hash
> 3f44cc87ceb87df1d9171096596a824fc3050a27 from commit
> 8577911bf6183497cc246aa620e7be1b6becec29

It would be easier to help you if you gave a URL for your repository :) (or at least for the subtree). I managed to find you Stack Overflow post [1] by Googling these commit hashes (!). Fortunately you mention the subtree URL in your question, and that's enough to go by in this case.

Show 11 quoted lines
> 
> What's different between what you expected and what actually happened?
> 
> Failed to update the subtree repo, as expected;
> 
> Anything else you want to add:
> 
> I am not able to find the commit/hash
> 3f44cc87ceb87df1d9171096596a824fc3050a27 in the repo. In gitx, I can
> see that the commit is a git-subtree-split. But it appears to no
> longer exist in the repo.

Here, I'm assuming that by "in the repo" you mean in a clone of the subtree repo, i.e. a clone of https://github.com/OpenSID/tema-natra.

Indeed the commit with hash 3f44cc87ceb87df1d9171096596a824fc3050a27 does not exist in such a clone. But, it still exists on GitHub:

https://github.com/OpenSID/tema-natra/commit/3f44cc87ceb87df1d9171096596a824fc3050a27

GitHub almost never removes commits in practice. This is good news, because it means you can fetch it locally.

> How can I bypass or recover from this apparent missing commit? Any
> help would be greatly appreciated.

The git-subtree script does need the commit locally to work. So, just fetch the commit by its hash. In your project repository (the one which uses tema-natra as a subtree), run:

git fetch https://github.com/OpenSID/tema-natra.git 3f44cc87ceb87df1d9171096596a824fc3050a27

This will download the needed objects. After that, you *should* be able to run your 'git subtree push' command.

Note: I think that the 'premium' branch (mentioned in your Stack Overflow question)
was indeed force-pushed, since 'git log --oneline dadcd0167^..' does not show the two
commits that appear in your image [2] that read "Update statistik_pengunjung.php"
Hope that helps,
Philippe.

[1] https://stackoverflow.com/questions/69431546/git-push-subtree-fail-unknown-revision-or-path-possibly-due-to-missing-git-subtr [2] https://i.stack.imgur.com/1tMln.jpg

Eddie Ridwan· Oct 7, 2021, 05:43 UTC · re: Philippe Blain · lore

Re: Git push subtree fail unknown revision or path possibly due to missing git-subtree-split commit

Hi Philippe

Many thanks for your help, and thanks for the tip regarding including the subtree URL in the question. Your suggestion worked in that the 'missing' commit is now in my local clone. And now the git push subtree does not generate any error.

Unfortunately it did not update the remote subtree repo. This is the only output of the push command:

git subtree push --prefix themes/natra https://github.com/OpenSID/tema-natra.git premium git push using: https://github.com/OpenSID/tema-natra.git premium 1/ 131 (436) [436]

On the other hand, git pull subtree continues to work as expected.

Any suggestions on how to find out why the git push subtree command did not update the remote repo?

Many thanks.
Eddie Ridwan

On Thu, 7 Oct 2021 at 13:52, Philippe Blain <levraiphilippeblain@gmail.com> wrote:

Show 79 quoted lines
>
> Hi Eddie,
>
> Le 2021-10-05 à 00:53, Eddie Ridwan a écrit :
> > 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)
> > git pull/push subtree as normal, although it is possible that one of
> > the contributors to the subtree repo may have done a force push.
>
> I think that is indeed what happened (see below).
>
> >
> > What did you expect to happen? (Expected behavior)
> > git push subtree to update the remote subtree repo.
> >
> > What happened instead? (Actual behavior)
> > Failed to update the remote subtree repo. Error message:
> >
> >         fatal: ambiguous argument
> > '3f44cc87ceb87df1d9171096596a824fc3050a27^{commit}': unknown revision
> > or path not in the working tree.
> >      Use '--' to separate paths from revisions, like this:
> >      'git <command> [<revision>...] -- [<file>...]'
> >      could not rev-parse split hash
> > 3f44cc87ceb87df1d9171096596a824fc3050a27 from commit
> > 8577911bf6183497cc246aa620e7be1b6becec29
>
> It would be easier to help you if you gave a URL for your repository :)
> (or at least for the subtree). I managed to find you Stack Overflow
> post [1] by Googling these commit hashes (!). Fortunately you mention
> the subtree URL in your question, and that's enough to go by in this case.
>
> >
> > What's different between what you expected and what actually happened?
> >
> > Failed to update the subtree repo, as expected;
> >
> > Anything else you want to add:
> >
> > I am not able to find the commit/hash
> > 3f44cc87ceb87df1d9171096596a824fc3050a27 in the repo. In gitx, I can
> > see that the commit is a git-subtree-split. But it appears to no
> > longer exist in the repo.
>
> Here, I'm assuming that by "in the repo" you mean in a clone of the subtree
> repo, i.e. a clone of https://github.com/OpenSID/tema-natra.
>
> Indeed the commit with hash 3f44cc87ceb87df1d9171096596a824fc3050a27 does not exist in
> such a clone. But, it still exists on GitHub:
>
> https://github.com/OpenSID/tema-natra/commit/3f44cc87ceb87df1d9171096596a824fc3050a27
>
> GitHub almost never removes commits in practice. This is good news, because
> it means you can fetch it locally.
>
> > How can I bypass or recover from this apparent missing commit? Any
> > help would be greatly appreciated.
>
> The git-subtree script does need the commit locally to work. So, just fetch
> the commit by its hash. In your project repository (the one which uses tema-natra as
> a subtree), run:
>
> git fetch https://github.com/OpenSID/tema-natra.git 3f44cc87ceb87df1d9171096596a824fc3050a27
>
> This will download the needed objects. After that, you *should* be able to
> run your 'git subtree push' command.
>
> Note: I think that the 'premium' branch (mentioned in your Stack Overflow question)
> was indeed force-pushed, since 'git log --oneline dadcd0167^..' does not show the two
> commits that appear in your image [2] that read "Update statistik_pengunjung.php"
>
> Hope that helps,
>
> Philippe.
>
> [1] https://stackoverflow.com/questions/69431546/git-push-subtree-fail-unknown-revision-or-path-possibly-due-to-missing-git-subtr
> [2] https://i.stack.imgur.com/1tMln.jpg
Philippe Blain· Oct 8, 2021, 01:14 UTC · lore

Re: Git push subtree fail unknown revision or path possibly due to missing git-subtree-split commit

Hi Eddie
[we reply inline on this mailing list, see below :)]
Le 2021-10-07 à 02:00, Eddie Ridwan a écrit :
Show 6 quoted lines
> Hi Philippe
> 
> Using the debug option (see attached file), I see that the git push
> subtree command is complaining that many commits are in the wrong
> order.
> 
Indeed, the attachment shows many messages like:
progress: 1/     131 (0) [0]
Processing commit: 1fbbdda4f0ef15794eeb4a343d3fb1bf17fbb853
   parents: c75f7cab156c91a1bf3b36658e1ac94dd1905bba
     incorrect order: c75f7cab156c91a1bf3b36658e1ac94dd1905bba
> Any idea how this could happen? And is there any way to recover from this?
I'm not a 'git subtree' user myself, so really don't know unfortunately.
> 
> Would it be best to just delete the subtree and start again?

You could do that. If you do want to debug further, I would suggest searching the mailing list (see https://lore.kernel.org/git/_/text/help/) for recent contributors to 'contrib/subtree' and CC-ing them. Maybe they will be able to provide more insight here.

You also asked on Stack Overflow if you should try to delete the subtree cache. I think this could be something to try (I would guess if it's called a cache, it should be recreated). But again I'm not a 'git subtree' user.

> 
> Many thanks
> 
> Eddie Ridwan
Cheers,
Philippe.

← back to recent threads