From: Andy Lowry <andy.work@nglowry.com>
To: Jeff King <peff@peff.net>
Cc: git <git@vger.kernel.org>
Subject: Re: BUG in git diff-index
Date: Thu, 31 Mar 2016 15:30:48 -0400 [thread overview]
Message-ID: <56FD7AE8.4090905@nglowry.com> (raw)
In-Reply-To: <20160331142704.GC31116@sigill.intra.peff.net>
OK, great. I think the update-index command is what I need.
If you'll indulge me, I'll describe my use-case in detail, and if you
see anything screwy about it, I'd appreciate feedback. But don't feel
obligated - you've been a great help already.
This is all about publishing updates to a static web site hosted as a
gh-pages branch on a github repo.
Our master branch has everything that goes into building the site, and
we use subtree push to update gh-pages with the embedded subtree that
contains the generated site.
I'm creating a bash script that does the publishing, and as a general
rule, we want to publish only from the master branch, and only if it's
clean and up-to-date. And we also want to make sure that the embedded
site reflects the current source content.
It's in that last requirement where diff-index comes in. The script runs
a site build, and then should fail the policy check if that results in
any changes to the working tree (including the embedded site)/. /I don't
want the script to change the index in any way (e.g. so that unintended
changes revealed by this policy check are less likely to be accidentally
commited).
If I understand correctly, the update-index operation you indicated will
not change index membership at all, but will simply resync the index
members with actual working tree files.
So I think now that the script should do "update-index --refresh"
followed by "diff-index --quiet HEAD". Sound correct?
Andy
On 3/31/2016 10:27 AM, Jeff King wrote:
> On Thu, Mar 31, 2016 at 10:12:07AM -0400, Andy Lowry wrote:
>
>> What I'm actually after is a tree-to-filesystem comparison, regardless
>> of index. I've currently got a "diff" thrown in as a "work-around"
>> before "diff-index", but now I understand it's not a workaround at
>> all. If there's a better way to achieve what I'm after, I'd appreciate
>> a tip. Otherwise I'll just change the comments explaining why there's
>> a "diff" in my script.
> If your workaround is just to refresh the index, then you can do "git
> update-index --refresh", rather than diff.
>
> I don't think there is a plumbing command to do a direct
> filesystem-to-tree comparison without having an index at all. "git diff
> <treeish>" claims in the documentation to do so, but besides not being
> plumbing, I think it is really just doing the same thing as diff-index,
> under the hood. The index is a pretty fundamental part of git's view of
> the working tree.
>
> -Peff
next prev parent reply other threads:[~2016-03-31 19:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-31 12:39 BUG in git diff-index Andy Lowry
2016-03-31 13:57 ` Carlos Martín Nieto
2016-03-31 14:05 ` Jeff King
2016-03-31 14:12 ` Andy Lowry
2016-03-31 14:27 ` Jeff King
2016-03-31 19:30 ` Andy Lowry [this message]
2016-03-31 20:39 ` Junio C Hamano
2017-09-26 19:46 ` Marc Herbert
2017-09-26 20:11 ` Eric Wong
2017-09-26 23:27 ` Google indexing https://public-inbox.org/git (was: BUG in git diff-index) Marc Herbert
2017-09-27 21:06 ` Wrong -dirty suffix set by setlocalversion " Marc Herbert
2018-05-24 23:03 ` Mike Mason
2018-05-25 3:50 ` Marc Herbert
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=56FD7AE8.4090905@nglowry.com \
--to=andy.work@nglowry.com \
--cc=git@vger.kernel.org \
--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).