New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Range diff with ranges lacking dotdot #841
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,17 @@ Finally, the list of matching commits is shown in the order of the | |
second commit range, with unmatched commits being inserted just after | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Johannes Schindelin wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
|
||
all of their ancestors have been shown. | ||
|
||
There are three ways to specify the commit ranges: | ||
|
||
- `<range1> <range2>`: Either commit range can be of the form | ||
`<base>..<rev>`, `<rev>^!` or `<rev>^-<n>`. See `SPECIFYING RANGES` | ||
in linkgit:gitrevisions[7] for more details. | ||
|
||
- `<rev1>...<rev2>`. This is equivalent to | ||
`<rev2>..<rev1> <rev1>..<rev2>`. | ||
|
||
- `<base> <rev1> <rev2>`: This is equivalent to `<base>..<rev1> | ||
<base>..<rev2>`. | ||
|
||
OPTIONS | ||
------- | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1680,7 +1680,7 @@ static void infer_range_diff_ranges(struct strbuf *r1, | |
struct commit *head) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Uwe Kleine-König wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Uwe Kleine-König wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Johannes Schindelin wrote (reply to this):
|
||
{ | ||
const char *head_oid = oid_to_hex(&head->object.oid); | ||
int prev_is_range = !!strstr(prev, ".."); | ||
int prev_is_range = is_range_diff_range(prev); | ||
|
||
if (prev_is_range) | ||
strbuf_addstr(r1, prev); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
#include "pretty.h" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Johannes Schindelin wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Johannes Schindelin wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Johannes Schindelin wrote (reply to this):
|
||
#include "userdiff.h" | ||
#include "apply.h" | ||
#include "revision.h" | ||
|
||
struct patch_util { | ||
/* For the search for an exact match */ | ||
|
@@ -564,3 +565,31 @@ int show_range_diff(const char *range1, const char *range2, | |
|
||
return res; | ||
} | ||
|
||
int is_range_diff_range(const char *arg) | ||
{ | ||
char *copy = xstrdup(arg); /* setup_revisions() modifies it */ | ||
const char *argv[] = { "", copy, "--", NULL }; | ||
int i, positive = 0, negative = 0; | ||
struct rev_info revs; | ||
|
||
init_revisions(&revs, NULL); | ||
if (setup_revisions(3, argv, &revs, NULL) == 1) { | ||
for (i = 0; i < revs.pending.nr; i++) | ||
if (revs.pending.objects[i].item->flags & UNINTERESTING) | ||
negative++; | ||
else | ||
positive++; | ||
for (i = 0; i < revs.pending.nr; i++) { | ||
struct object *obj = revs.pending.objects[i].item; | ||
|
||
if (obj->type == OBJ_COMMIT) | ||
clear_commit_marks((struct commit *)obj, | ||
ALL_REV_FLAGS); | ||
} | ||
} | ||
|
||
free(copy); | ||
object_array_clear(&revs.pending); | ||
return negative > 0 && positive > 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Johannes Schindelin wrote (reply to this):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Johannes Schindelin wrote (reply to this):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Junio C Hamano wrote (reply to this):