From: Andreas Ericsson <ae@op5.se>
To: Git Mailing List <git@vger.kernel.org>
Subject: git diff woes
Date: Mon, 12 Nov 2007 10:44:45 +0100 [thread overview]
Message-ID: <4738208D.1080003@op5.se> (raw)
I recently ran into an oddity with the excellent git diff output
format. When a function declaration changes in the same patch as
something else in a function, the old declaration is used with the
diff hunk-headers.
Consider this hunk:
---%<---%<---%<---
@@ -583,75 +346,100 @@ double jitter_request(const char *host, int *status){
if(verbose) printf("%d candiate peers available\n", num_candidates);
if(verbose && syncsource_found) printf("synchronization source found\n")
if(! syncsource_found){
- *status = STATE_UNKNOWN;
+ status = STATE_WARNING;
if(verbose) printf("warning: no synchronization source found\n")
}
---%<---%<---%<---
It definitely looks like a bug, but really isn't, since an earlier hunk
(pasted below) changes the declaration. There were several hunks between
these two, so it was far from obvious when I saw it first.
---%<---%<---%<---
@@ -517,19 +276,22 @@ setup_control_request(ntp_control_message *p, uint8_t opco
}
/* XXX handle responses with the error bit set */
-double jitter_request(const char *host, int *status){
- int conn=-1, i, npeers=0, num_candidates=0, syncsource_found=0;
- int run=0, min_peer_sel=PEER_INCLUDED, num_selected=0, num_valid=0;
+int ntp_request(const char *host, double *offset, int *offset_result, double *j
+ int conn=-1, i, npeers=0, num_candidates=0;
+ int min_peer_sel=PEER_INCLUDED;
int peers_size=0, peer_offset=0;
+ int status;
---%<---%<---%<---
This makes it impossible to trust the hunk-header info if the declaration
changes. It might be better to not write it out when the header-line is
also part of the patch. That would at least force one to go back and find
the real declaration. Best would probably be to write the new declaration,
but I'm unsure if that could cause some other confusion.
I haven't started looking into it yet, and as I'm sure there are others
who are much more familiar with the xdiff code I'm shamelessly hoping
someone will beat me to a fix.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
next reply other threads:[~2007-11-12 9:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-12 9:44 Andreas Ericsson [this message]
2007-11-12 10:01 ` git diff woes Johannes Schindelin
2007-11-12 10:35 ` Andreas Ericsson
2007-11-12 10:50 ` Johannes Schindelin
2007-11-12 11:19 ` Andreas Ericsson
2007-11-12 21:30 ` Junio C Hamano
2007-11-13 0:03 ` Andreas Ericsson
2007-11-13 0:59 ` Johannes Schindelin
2007-11-13 2:53 ` Miles Bader
2007-11-13 7:40 ` Andreas Ericsson
2007-11-13 9:15 ` [PATCH] diffcore: Allow users to decide what funcname to use Andreas Ericsson
2007-11-13 10:03 ` Jakub Narebski
2007-11-13 10:07 ` Andreas Ericsson
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=4738208D.1080003@op5.se \
--to=ae@op5.se \
--cc=git@vger.kernel.org \
/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).