git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: git@vger.kernel.org, peff@peff.net
Subject: Re: [PATCH v2] doc: remove misleading documentation on pack names
Date: Wed, 22 Jul 2020 14:09:37 -0700	[thread overview]
Message-ID: <xmqq5zaf5ka6.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20200722202629.109277-1-johannes@sipsolutions.net> (Johannes Berg's message of "Wed, 22 Jul 2020 22:26:29 +0200")

Johannes Berg <johannes@sipsolutions.net> writes:

> The index-pack documentation explicitly states that the pack
> name is derived from the sorted list of object names, but
> that clearly isn't true. I can't seem to be able to figure
> out if this was ever changed though.
>
> Be less explicit in the docs as to what the exact output is,
> and just say that it's whatever goes into the pack name.
>
> Really it seems to be the sha1 of the entire file, without
> the checksum footer.

Please avoid "seems to be" and spend a bit of effort digging the
history especially when we are not in a hurry to get to the definite
answer.  We can go "less explicit", or be a bit more informative by
saying that it is the trailer hash that is standard practice shared
across our binary files like the index and the packfile.

I think this is 1190a1ac (pack-objects: name pack files after
trailer hash, 2013-12-05).  It forgot to update the comment before
write_idx_file() function when it did this change:

 /*
  * On entry *sha1 contains the pack content SHA1 hash, on exit it is
  * the SHA1 hash of sorted object names. The objects array passed in
  * will be sorted by SHA1 on exit.
  */
 const char *write_idx_file(const char *index_name, struct pack_idx_entry **objects,
 			   int nr_objects, const struct pack_idx_option *opts,
-			   unsigned char *sha1)
+			   const unsigned char *sha1)
 {

Obviously, after it turned *sha1 into 'const', it no longer is
possible for it to have anything different from what was passed in
upon exit.

> +Once the index has been created, the hash that goes into the name of
> +the pack/idx file is printed to stdout. If --stdin was also used then
> +this is prefixed by either "pack\t", or "keep\t" if a new .keep file
> +was successfully created. This is useful to remove a .keep file used
> +as a lock to prevent the race with 'git repack' mentioned above.

The change is good---I made sure that among these filve lines, what
changed was only the first one and half lines.  I however would have
preferred not to see the line rewrapping.

Thanks.

  reply	other threads:[~2020-07-22 21:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22 20:26 [PATCH v2] doc: remove misleading documentation on pack names Johannes Berg
2020-07-22 21:09 ` Junio C Hamano [this message]
2020-07-22 21:14   ` Johannes Berg
2020-07-22 21:16     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq5zaf5ka6.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).