From: Jeff King <peff@peff.net>
To: Neal Kreitzinger <nkreitzinger@gmail.com>
Cc: Neal Kreitzinger <neal@rsss.com>, git@vger.kernel.org
Subject: Re: git-reset HEAD --permissions-only
Date: Thu, 17 Mar 2011 02:01:29 -0400 [thread overview]
Message-ID: <20110317060129.GC11931@sigill.intra.peff.net> (raw)
In-Reply-To: <4D800D0B.2000307@gmail.com>
On Tue, Mar 15, 2011 at 08:06:19PM -0500, Neal Kreitzinger wrote:
> You are right about git checkout -p because there are alot of code
> changes to alot of files. I haven't used git patches and I don't
> know perl. However, your reasoning about the last example seems the
> most straight-forward so I used it. I symptomatically validated my
> re-keying of the syntax as follows since TTBOMK I couldn't copy+paste
> your example due to whitespace:
>
> git ls-files -sz | perl -0ne '/100(\d+).*?\t(.*)/
> or next; -e $2 or next; chmod(oct($1), $2) or die "chmod failed: $!";'
The whitespace in what I sent was fine, though it's possible your MUA
mangled it.
It sounds like the solution worked for you, so cool. But I did have one
more thought to mention: since you are working with a vendor branch, you
should be able to have a "pristine" vendor branch complete with their
wrong permissions, and then build your permissions fixes on top of that.
And then when you merge the pristine branch up to your branch, git will
automatically resolve the permissions in favor of yours (because its
built on top).
So something like:
# import initial vendor branch
git init
# untar or whatever happens to get the files
tar xzf /path/to/vendor-1.0.tar.gz
git add .
git commit -m 'import vendor 1.0'
# now move it to vendor branch and make our munged-vendor branch
git branch vendor
git checkout -b vendor-fixed vendor
# now tweak permissions
.. chmod or however you did it originally ...
git add -u
git commit -m 'fix broken vendor permissions'
# and then built your real work on top of vendor-fixed
git branch -f master vendor-fixed
git checkout master
# weeks pass; vendor releases 1.1
git checkout vendor
# untar or whatever we do to get the files
tar xzf /path/to/vendor-1.1.tar.gz
git add -A
git commit -m 'import vendor 1.1'
# now we merge it in, but our permissions fixes will be retained
git checkout vendor-fixed
git merge vendor
# however we may still have to deal with new files
... chmod or whatever on new files ...
git add -u
git commit -m 'fix more broken vendor permissions'
...and repeat for each new version the vendor releases.
That gives you three branches: vendor with the pristine vendor source,
vendor-fixed with any baseline fixes (permissions changes in this case),
and then your real work goes on master (or on topic branches that get
merged to master).
You could also omit the vendor-fixed branch and just put your fixes on
the master branch. Doing it with the third branch, though, means you
will have a less noisy diff doing "git diff master vendor-fixed", since
it will not include all the permissions mucking.
-Peff
prev parent reply other threads:[~2011-03-17 6:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-14 20:29 git-reset HEAD --permissions-only Neal Kreitzinger
2011-03-15 1:32 ` Jeff King
2011-03-16 1:06 ` Neal Kreitzinger
2011-03-17 6:01 ` Jeff King [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110317060129.GC11931@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=neal@rsss.com \
--cc=nkreitzinger@gmail.com \
/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.
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 NNTP newsgroup(s).