git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
blob 1bcfd935cf509e10c4864afa296ce5810f039f27 734 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) <= 0)
			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 1bcfd935cf50 ...
found 1bcfd935cf50 in https://public-inbox.org/git/pull.870.v4.git.1613308167239.gitgitgadget@gmail.com/

applying [1/1] https://public-inbox.org/git/pull.870.v4.git.1613308167239.gitgitgadget@gmail.com/
diff --git a/diffcore-rotate.c b/diffcore-rotate.c
new file mode 100644
index 000000000000..1bcfd935cf50

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

index at:
100644 1bcfd935cf509e10c4864afa296ce5810f039f27	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).