On 04/16/2010 11:23 PM, Junio C Hamano wrote:
I have an alias that takes two arguments and compares their patch IDs.
I would like to use to make sure I've tested exactly what I submit
(patch by patch), like
git patch-cmp origin/master.. file-being-sent
...
I somehow have a feeling that this is solving a wrong problem.
In what sense?
Why does file-being-sent have anything from origin/master to begin with?
Perhaps the --ignore-if-in-upstream mechanism needs to be updated so that
you won't have duplicates that patch-id could easily find in the first
place?
I think we're speaking about different things, --ignore-if-in-upstream
doesn't have anything to do with this. The git patch-cmp alias is just
checking that
git show origin/master.. | git patch-id | tac | awk '{print $1}'
and
git patch-id < file-being-sent | awk '{print $1}'
produce the exact same output.
I use this when I had to edit the file-being-sent, e.g. to add cover
letters or an introduction to a patch series. Since some time passes
between format-patch and send-email, I want to test that the file I'm
sending is exactly what I have in the repository, and that I'm not
submitting the wrong series.
Alternatively, I could apply file-being-sent to a detached HEAD and
compare the trees, like
topic=`git rev-parse HEAD`
git checkout origin/master
git am file-being-sent || echo bad
mine=HEAD
for i in `git rev-list origin/master..$topic`; do
git diff-tree $i $mine || echo bad
mine=${mine}^
done
However, comparing the patch-id is faster and perfect for this job.
What were your intended uses for the git-patch-id utility?
Paolo
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html