Re: [PUB]corrupt repos does not return error with `git fsck`

11 messages, 6 authors, 2016-06-15 · open the first message on its own page

Re: [PUB]corrupt repos does not return error with `git fsck`

From: Matthieu Moy <hidden>
Date: 2016-06-15 23:04:50

Faheem Mitha [off-list ref] writes:
Hi,

Clone the repos https://github.com/fmitha/SICL.

Then

    git show 280c12ab49223c64c6f914944287a7d049cf4dd0

gives

    fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0
It seems 280c12ab49223c64c6f914944287a7d049cf4dd0 is not an object in
your repository. The good news it: I don't think you have a corrupt
repository. What makes you think you have an object with identifier
280c12ab49223c64c6f914944287a7d049cf4dd0?

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

Re: [PUB]corrupt repos does not return error with `git fsck`

From: Johannes Schindelin <hidden>
Date: 2016-06-15 23:04:50

Hi,

On 2015-05-20 19:19, Matthieu Moy wrote:
Faheem Mitha [off-list ref] writes:
quoted
Clone the repos https://github.com/fmitha/SICL.

Then

    git show 280c12ab49223c64c6f914944287a7d049cf4dd0

gives

    fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0
It seems 280c12ab49223c64c6f914944287a7d049cf4dd0 is not an object in
your repository. The good news it: I don't think you have a corrupt
repository. What makes you think you have an object with identifier
280c12ab49223c64c6f914944287a7d049cf4dd0?
I had a similar problem some time ago and tracked it down to a graft that was active while pushing to the public repository. Maybe it's the same problem here?

Ciao,
Johannes

Re: [PUB]corrupt repos does not return error with `git fsck`

From: Faheem Mitha <hidden>
Date: 2016-06-15 23:04:50

On Wed, 20 May 2015, Matthieu Moy wrote:
Faheem Mitha [off-list ref] writes:
quoted
Hi,
quoted
Clone the repos https://github.com/fmitha/SICL.
quoted
Then
quoted
    git show 280c12ab49223c64c6f914944287a7d049cf4dd0
quoted
gives
quoted
    fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0
It seems 280c12ab49223c64c6f914944287a7d049cf4dd0 is not an object in
your repository. The good news it: I don't think you have a corrupt
repository. What makes you think you have an object with identifier
280c12ab49223c64c6f914944287a7d049cf4dd0?
I was going by the answer (by CodeWizard) in 
http://stackoverflow.com/q/30348615/350713

The question there also gives the context of this question.

The repos I referenced in my post to the git mailing list just now, is 
just a clone of https://github.com/drmeister/SICL.

If I just give a random hash to `git show` in that repos, I get

     fatal: ambiguous argument '...': unknown revision or path not in the working tree.

It seemed reasonable to assume (based on what little knowledge I had 
about) that the 280c12ab49223c64c6f914944287a7d049cf4dd0 commit was the 
problem.

However, this repos is a fork of another repos, namely 
https://github.com/robert-strandh/SICL

That repos contains more recent commits than the fork does.

If I take any of the more recent commits from that repos, and try the hash 
with `git show`, i.e.

     git show <hash>

in the fork, I get the same error, which makes to me think something else 
must be going on.

Chris (drmeister) has modified the path the submodule is obtained from, so 
the instructions in the SO question won't work as a reproduction recipe 
any more, but if you want to take a look I could clone his repos and set 
it up the same way it was. Let me know.

                                                     Regards, Faheem Mitha

Re: [PUB]corrupt repos does not return error with `git fsck`

From: Stefan Beller <hidden>
Date: 2016-06-15 23:04:50

$ git clone https://github.com/fmitha/SICL
cd SICL
$ git show 280c12ab49223c64c6f914944287a7d049cf4dd0
fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0
$ git show 12323213123 # just to be sure to have a different error
message for non existing objects.
fatal: ambiguous argument '12323213123': unknown revision or path not
in the working tree.

$ mv .git/objects/pack/pack-d56da8c18f5aa915d7fe230efae7315a0101dc19.pack .
$ rm .git/objects/pack/pack-d56da8c18f5aa915d7fe230efae7315a0101dc19.idx
$ git unpack-objects < pack-d56da8c18f5aa915d7fe230efae7315a0101dc19.pack
$ git show 280c12ab49223c64c6f914944287a7d049cf4dd0
fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0
$ ls .git/objects/28/0*
.git/objects/28/01fef08b1dccf9725dde919a7373748a046cb7
.git/objects/28/03d8c1cb3275979ff2d8408450844f6a78a70d
.git/objects/28/0663a93d702a7fcb0dd36f461397f6b50ba01e
.git/objects/28/068e2656dd4bac61050e870712578032af9144
.git/objects/28/074e890d6ff2bb61eb7796bc500b6d8e344ad2
.git/objects/28/08596ac465cf8a819a9b13ad2f855e9a8a3235
.git/objects/28/098184d1ba97453227c18628cdf13087b6bce2
.git/objects/28/0ba19c68b26ee7c799ef8ca09d540a5ad7a5b2
.git/objects/28/0d66213173f0ae7aaae8684f3efcb1f8790792
.git/objects/28/0da35374c32303cbd726bef9847f18d7428d5e

There is no file 28/0c... however.

Re: [PUB]corrupt repos does not return error with `git fsck`

From: Jeff King <hidden>
Date: 2016-06-15 23:04:50

On Wed, May 20, 2015 at 11:02:14AM -0700, Stefan Beller wrote:
$ git clone https://github.com/fmitha/SICL
cd SICL
$ git show 280c12ab49223c64c6f914944287a7d049cf4dd0
fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0
$ git show 12323213123 # just to be sure to have a different error
message for non existing objects.
fatal: ambiguous argument '12323213123': unknown revision or path not
in the working tree.
Yeah, this is well-known. If you give a partial hash, the error comes
from get_sha1(), which says "hey, this doesn't look like anything I know
about". If you feed a whole hash, we skip all that and say "well, you
_definitely_ meant this sha1", and then later code complains when it
cannot be read.

We could add a has_sha1_file() check in get_sha1 for this case. I can't
think offhand of any reason it would need to be called with a
non-existent object, but there may be some lurking corner case (e.g.,
"cat-file -e" or something).

-Peff

Re: [PUB]corrupt repos does not return error with `git fsck`

From: Faheem Mitha <hidden>
Date: 2016-06-15 23:04:50

Hi Stefan,

Thank you for the reply, but I don't follow what conclusion you are 
drawing, if any.

On Wed, 20 May 2015, Stefan Beller wrote:
$ git clone https://github.com/fmitha/SICL
cd SICL
$ git show 280c12ab49223c64c6f914944287a7d049cf4dd0
fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0
$ git show 12323213123 # just to be sure to have a different error
message for non existing objects.
fatal: ambiguous argument '12323213123': unknown revision or path not
in the working tree.

$ mv .git/objects/pack/pack-d56da8c18f5aa915d7fe230efae7315a0101dc19.pack .
$ rm .git/objects/pack/pack-d56da8c18f5aa915d7fe230efae7315a0101dc19.idx
$ git unpack-objects < pack-d56da8c18f5aa915d7fe230efae7315a0101dc19.pack
$ git show 280c12ab49223c64c6f914944287a7d049cf4dd0
fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0
$ ls .git/objects/28/0*
.git/objects/28/01fef08b1dccf9725dde919a7373748a046cb7
.git/objects/28/03d8c1cb3275979ff2d8408450844f6a78a70d
.git/objects/28/0663a93d702a7fcb0dd36f461397f6b50ba01e
.git/objects/28/068e2656dd4bac61050e870712578032af9144
.git/objects/28/074e890d6ff2bb61eb7796bc500b6d8e344ad2
.git/objects/28/08596ac465cf8a819a9b13ad2f855e9a8a3235
.git/objects/28/098184d1ba97453227c18628cdf13087b6bce2
.git/objects/28/0ba19c68b26ee7c799ef8ca09d540a5ad7a5b2
.git/objects/28/0d66213173f0ae7aaae8684f3efcb1f8790792
.git/objects/28/0da35374c32303cbd726bef9847f18d7428d5e

There is no file 28/0c... however.
So, is the repos corrupt or not? Also, I don't understand why you say

     There is no file 28/0c... however.

Why would you expect there to be? I don't see it mentioned in that list.

I apologise for my ignorance. I don't really know anything about git. I 
just happened to encounter this error.

                                                   Regards, Faheem Mitha

Re: [PUB]corrupt repos does not return error with `git fsck`

From: John Keeping <hidden>
Date: 2016-06-15 23:04:50

On Wed, May 20, 2015 at 11:02:14AM -0700, Stefan Beller wrote:
$ git clone https://github.com/fmitha/SICL
cd SICL
$ git show 280c12ab49223c64c6f914944287a7d049cf4dd0
fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0
$ git show 12323213123 # just to be sure to have a different error
message for non existing objects.
fatal: ambiguous argument '12323213123': unknown revision or path not
in the working tree.
I think 40 hex characters is special cased.  Using CGit as a repository
with a submodule so I can easily get an unrelated SHA1 and short name:

cgit $ git show $(git -C git rev-parse @)
fatal: bad object bb8577532add843833ebf8b5324f94f84cb71ca0
cgit $ git show $(git -C git rev-parse --short @)
fatal: ambiguous argument 'bb85775': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Re: [PUB]corrupt repos does not return error with `git fsck`

From: Jeff King <hidden>
Date: 2016-06-15 23:04:50

On Wed, May 20, 2015 at 02:22:19PM -0400, Jeff King wrote:
On Wed, May 20, 2015 at 11:02:14AM -0700, Stefan Beller wrote:
quoted
$ git clone https://github.com/fmitha/SICL
cd SICL
$ git show 280c12ab49223c64c6f914944287a7d049cf4dd0
fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0
$ git show 12323213123 # just to be sure to have a different error
message for non existing objects.
fatal: ambiguous argument '12323213123': unknown revision or path not
in the working tree.
Yeah, this is well-known. If you give a partial hash, the error comes
from get_sha1(), which says "hey, this doesn't look like anything I know
about". If you feed a whole hash, we skip all that and say "well, you
_definitely_ meant this sha1", and then later code complains when it
cannot be read.

We could add a has_sha1_file() check in get_sha1 for this case. I can't
think offhand of any reason it would need to be called with a
non-existent object, but there may be some lurking corner case (e.g.,
"cat-file -e" or something).
I should have looked before replying. It would indeed break "cat-file
-e" horribly. So the right answer may be to just improve the "bad
object" message (probably by checking has_sha1_file there and diagnosing
it either as missing or corrupted).

-Peff

Re: [PUB]corrupt repos does not return error with `git fsck`

From: Stefan Beller <hidden>
Date: 2016-06-15 23:04:50

On Wed, May 20, 2015 at 11:24 AM, Faheem Mitha [off-list ref] wrote:
So, is the repos corrupt or not? Also, I don't understand why you say

    There is no file 28/0c... however.

Why would you expect there to be? I don't see it mentioned in that list.
Each object is stored at .git/objects/<xz>/<tail> with <xz> being the first
2 characters of the sha1 and the tail the remaining 38 characters of the sha1.
I did not draw a conclusion yet, as I needed to run for a meeting.

So the object you're looking for is not there (stating this as a fact).
But why would you expect it to be there? At the time of sending the previous
email I tried to do a reverse search "Give me all objects, which
reference objectX"
but did not succeed yet.

Stefan

Re: [PUB]corrupt repos does not return error with `git fsck`

From: Faheem Mitha <hidden>
Date: 2016-06-15 23:04:50

On Wed, 20 May 2015, Stefan Beller wrote:
On Wed, May 20, 2015 at 11:24 AM, Faheem Mitha [off-list ref] wrote:
quoted
So, is the repos corrupt or not? Also, I don't understand why you say
quoted
    There is no file 28/0c... however.
quoted
Why would you expect there to be? I don't see it mentioned in that list.
Each object is stored at .git/objects/<xz>/<tail> with <xz> being the 
first 2 characters of the sha1 and the tail the remaining 38 characters 
of the sha1. I did not draw a conclusion yet, as I needed to run for a 
meeting.
So the object you're looking for is not there (stating this as a fact). 
But why would you expect it to be there? At the time of sending the 
previous email I tried to do a reverse search "Give me all objects, 
which reference objectX" but did not succeed yet.
Ok. See my reply to Matthieu Moy for context. I make have been taking too 
much for granted before posting to this list. Maybe I should have asked 
here first.

As I wrote to him, I can reconstruct the original setup if anyone thinks 
it is worthwhile trying to investigate further.

                                                    Regards, Faheem Mitha

Re: [PUB]corrupt repos does not return error with `git fsck`

From: Matthieu Moy <hidden>
Date: 2016-06-15 23:04:51

sbeller@google.com writes:
$ git clone https://github.com/fmitha/SICL
cd SICL
$ git show 280c12ab49223c64c6f914944287a7d049cf4dd0
fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0
$ git show 12323213123 # just to be sure to have a different error message for non existing objects.
I did the same, but the error message is different if you provide an abreviated sha1 or a full 40-chars sha1.

Any full sha1 I tried gave the same error message.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help