git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
blob 0d1790161680b2e3bd89cd9667d3a89600e9c488 730 bytes (raw)
name: diffcore-rotate.c 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
/*
 * Copyright (C) 2021, Google LLC.
 * Based on diffcore-order.c, which is Copyright (C) 2005, Junio C Hamano
 */
#include "cache.h"
#include "diff.h"
#include "diffcore.h"

void diffcore_rotate(const char *rotate_to_filename)
{
	struct diff_queue_struct *q = &diff_queued_diff;
	struct diff_queue_struct outq;
	int rotate_to, i;

	if (!q->nr)
		return;

	for (i = 0; i < q->nr; i++)
		if (!strcmp(rotate_to_filename, q->queue[i]->two->path))
			break;
	/* we did not find the specified path */
	if (q->nr <= i)
		return;

	DIFF_QUEUE_CLEAR(&outq);
	rotate_to = i;

	for (i = rotate_to; i < q->nr; i++)
		diff_q(&outq, q->queue[i]);
	for (i = 0; i < rotate_to; i++)
		diff_q(&outq, q->queue[i]);

	free(q->queue);
	*q = outq;
}

debug log:

solving 0d17901616 ...
found 0d17901616 in https://public-inbox.org/git/xmqqeehp2jis.fsf@gitster.c.googlers.com/

applying [1/1] https://public-inbox.org/git/xmqqeehp2jis.fsf@gitster.c.googlers.com/
diff --git c/diffcore-rotate.c w/diffcore-rotate.c
new file mode 100644
index 0000000000..0d17901616

Checking patch diffcore-rotate.c...
Applied patch diffcore-rotate.c cleanly.

index at:
100644 0d1790161680b2e3bd89cd9667d3a89600e9c488	diffcore-rotate.c

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).