Skip to content

Commit 49944df

Browse files
committed
Sync with 'master'
2 parents 7711bb0 + 3fb7452 commit 49944df

File tree

4 files changed

+36
-112
lines changed

4 files changed

+36
-112
lines changed

Documentation/RelNotes/2.46.2.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Git 2.46.2 Release Notes
2+
========================
3+
4+
This release is primarily to merge changes to unbreak the 32-bit
5+
GitHub actions jobs we use for CI testing, so that we can release
6+
real fixes for the 2.46.x track after they pass CI.
7+
8+
It also reverts the "git patch-id" change that went into 2.46.1,
9+
as it seems to have got a regression reported (I haven't verified,
10+
but it is better to keep a known breakage than adding an unintended
11+
regression).

Documentation/RelNotes/2.47.0.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ Performance, Internal Implementation, Development Support etc.
136136
* "git cat-file" works well with the sparse-index, and gets marked as
137137
such.
138138

139+
* CI started failing completely for linux32 jobs, as the step to
140+
upload failed test directory uses GitHub actions that is deprecated
141+
and is now disabled.
142+
139143

140144
Fixes since v2.46
141145
-----------------

builtin/patch-id.c

Lines changed: 21 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
#include "parse-options.h"
99
#include "setup.h"
1010

11-
static void flush_current_id(struct object_id *id, struct object_id *result)
11+
static void flush_current_id(int patchlen, struct object_id *id, struct object_id *result)
1212
{
13-
printf("%s %s\n", oid_to_hex(result), oid_to_hex(id));
13+
if (patchlen)
14+
printf("%s %s\n", oid_to_hex(result), oid_to_hex(id));
1415
}
1516

1617
static int remove_space(char *line)
@@ -60,27 +61,9 @@ static int scan_hunk_header(const char *p, int *p_before, int *p_after)
6061
return 1;
6162
}
6263

63-
/*
64-
* flag bits to control get_one_patchid()'s behaviour.
65-
*
66-
* STABLE/VERBATIM are given from the command line option as
67-
* --stable/--verbatim. FIND_HEADER conveys the internal state
68-
* maintained by the caller to allow the function to avoid mistaking
69-
* lines of log message before seeing the "diff" part as the beginning
70-
* of the next patch.
71-
*/
72-
enum {
73-
GOPID_STABLE = (1<<0), /* --stable */
74-
GOPID_VERBATIM = (1<<1), /* --verbatim */
75-
GOPID_FIND_HEADER = (1<<2), /* stop at the beginning of patch message */
76-
};
77-
7864
static int get_one_patchid(struct object_id *next_oid, struct object_id *result,
79-
struct strbuf *line_buf, unsigned flags)
65+
struct strbuf *line_buf, int stable, int verbatim)
8066
{
81-
int stable = flags & GOPID_STABLE;
82-
int verbatim = flags & GOPID_VERBATIM;
83-
int find_header = flags & GOPID_FIND_HEADER;
8467
int patchlen = 0, found_next = 0;
8568
int before = -1, after = -1;
8669
int diff_is_binary = 0;
@@ -95,40 +78,24 @@ static int get_one_patchid(struct object_id *next_oid, struct object_id *result,
9578
const char *p = line;
9679
int len;
9780

98-
/*
99-
* The caller hasn't seen us find a patch header and
100-
* return to it, or we have started processing patch
101-
* and may encounter the beginning of the next patch.
102-
*/
103-
if (find_header) {
104-
/*
105-
* If we see a line that begins with "<object name>",
106-
* "commit <object name>" or "From <object name>", it is
107-
* the beginning of a patch. Return to the caller, as
108-
* we are done with the one we have been processing.
109-
*/
110-
if (skip_prefix(line, "commit ", &p))
111-
;
112-
else if (skip_prefix(line, "From ", &p))
113-
;
114-
if (!get_oid_hex(p, next_oid)) {
115-
if (verbatim)
116-
the_hash_algo->update_fn(&ctx, line, strlen(line));
117-
found_next = 1;
118-
break;
119-
}
81+
/* Possibly skip over the prefix added by "log" or "format-patch" */
82+
if (!skip_prefix(line, "commit ", &p) &&
83+
!skip_prefix(line, "From ", &p) &&
84+
starts_with(line, "\\ ") && 12 < strlen(line)) {
85+
if (verbatim)
86+
the_hash_algo->update_fn(&ctx, line, strlen(line));
87+
continue;
88+
}
89+
90+
if (!get_oid_hex(p, next_oid)) {
91+
found_next = 1;
92+
break;
12093
}
12194

12295
/* Ignore commit comments */
12396
if (!patchlen && !starts_with(line, "diff "))
12497
continue;
12598

126-
/*
127-
* We are past the commit log message. Prepare to
128-
* stop at the beginning of the next patch header.
129-
*/
130-
find_header = 1;
131-
13299
/* Parsing diff header? */
133100
if (before == -1) {
134101
if (starts_with(line, "GIT binary patch") ||
@@ -161,16 +128,6 @@ static int get_one_patchid(struct object_id *next_oid, struct object_id *result,
161128
break;
162129
}
163130

164-
/*
165-
* A hunk about an incomplete line may have this
166-
* marker at the end, which should just be ignored.
167-
*/
168-
if (starts_with(line, "\\ ") && 12 < strlen(line)) {
169-
if (verbatim)
170-
the_hash_algo->update_fn(&ctx, line, strlen(line));
171-
continue;
172-
}
173-
174131
if (diff_is_binary) {
175132
if (starts_with(line, "diff ")) {
176133
diff_is_binary = 0;
@@ -217,20 +174,17 @@ static int get_one_patchid(struct object_id *next_oid, struct object_id *result,
217174
return patchlen;
218175
}
219176

220-
static void generate_id_list(unsigned flags)
177+
static void generate_id_list(int stable, int verbatim)
221178
{
222179
struct object_id oid, n, result;
223180
int patchlen;
224181
struct strbuf line_buf = STRBUF_INIT;
225182

226183
oidclr(&oid, the_repository->hash_algo);
227-
flags |= GOPID_FIND_HEADER;
228184
while (!feof(stdin)) {
229-
patchlen = get_one_patchid(&n, &result, &line_buf, flags);
230-
if (patchlen)
231-
flush_current_id(&oid, &result);
185+
patchlen = get_one_patchid(&n, &result, &line_buf, stable, verbatim);
186+
flush_current_id(patchlen, &oid, &result);
232187
oidcpy(&oid, &n);
233-
flags &= ~GOPID_FIND_HEADER;
234188
}
235189
strbuf_release(&line_buf);
236190
}
@@ -269,7 +223,6 @@ int cmd_patch_id(int argc,
269223
/* if nothing is set, default to unstable */
270224
struct patch_id_opts config = {0, 0};
271225
int opts = 0;
272-
unsigned flags = 0;
273226
struct option builtin_patch_id_options[] = {
274227
OPT_CMDMODE(0, "unstable", &opts,
275228
N_("use the unstable patch-id algorithm"), 1),
@@ -301,11 +254,7 @@ int cmd_patch_id(int argc,
301254
if (!the_hash_algo)
302255
repo_set_hash_algo(the_repository, GIT_HASH_SHA1);
303256

304-
if (opts ? opts > 1 : config.stable)
305-
flags |= GOPID_STABLE;
306-
if (opts ? opts == 3 : config.verbatim)
307-
flags |= GOPID_VERBATIM;
308-
generate_id_list(flags);
309-
257+
generate_id_list(opts ? opts > 1 : config.stable,
258+
opts ? opts == 3 : config.verbatim);
310259
return 0;
311260
}

t/t4204-patch-id.sh

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -114,46 +114,6 @@ test_expect_success 'patch-id supports git-format-patch output' '
114114
test "$2" = $(git rev-parse HEAD)
115115
'
116116

117-
test_expect_success 'patch-id computes the same for various formats' '
118-
# This test happens to consider "git log -p -1" output
119-
# the canonical input format, so use it as the norm.
120-
git log -1 -p same >log-p.output &&
121-
git patch-id <log-p.output >expect &&
122-
123-
# format-patch begins with "From <commit object name>"
124-
git format-patch -1 --stdout same >format-patch.output &&
125-
git patch-id <format-patch.output >actual &&
126-
test_cmp actual expect &&
127-
128-
# "diff-tree --stdin -p" begins with "<commit object name>"
129-
same=$(git rev-parse same) &&
130-
echo $same | git diff-tree --stdin -p >diff-tree.output &&
131-
git patch-id <diff-tree.output >actual &&
132-
test_cmp actual expect &&
133-
134-
# "diff-tree --stdin -v -p" begins with "commit <commit object name>"
135-
echo $same | git diff-tree --stdin -p -v >diff-tree-v.output &&
136-
git patch-id <diff-tree-v.output >actual &&
137-
test_cmp actual expect
138-
'
139-
140-
hash=$(git rev-parse same:)
141-
for cruft in "$hash" "commit $hash is bad" "From $hash status"
142-
do
143-
test_expect_success "patch-id with <$cruft> in log message" '
144-
git format-patch -1 --stdout same >patch-0 &&
145-
git patch-id <patch-0 >expect &&
146-
147-
{
148-
sed -e "/^$/q" patch-0 &&
149-
printf "random message\n%s\n\n" "$cruft" &&
150-
sed -e "1,/^$/d" patch-0
151-
} >patch-cruft &&
152-
git patch-id <patch-cruft >actual &&
153-
test_cmp actual expect
154-
'
155-
done
156-
157117
test_expect_success 'whitespace is irrelevant in footer' '
158118
get_patch_id main &&
159119
git checkout same &&

0 commit comments

Comments
 (0)