git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
blob e9a0954dcbf1540314cb6f19ae58e4a824a21c97 1438 bytes (raw)
name: builtin/mktag.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 
#include "builtin.h"
#include "tag.h"
#include "object-store.h"
#include "fsck.h"

static int mktag_fsck_error_func(struct fsck_options *o,
				 const struct object_id *oid,
				 enum object_type object_type,
				 int msg_type, const char *message)
{
	switch (msg_type) {
	case FSCK_WARN:
	case FSCK_ERROR:
	case FSCK_EXTRA:
		/*
		 * We treat both warnings and errors as errors, things
		 * like missing "tagger" lines are "only" warnings
		 * under fsck, we've always considered them an error.
		 */
		fprintf_ln(stderr, "error: %s", message);
		return 1;
	default:
		BUG("%d (FSCK_IGNORE?) should never trigger this callback",
		    msg_type);
	}
}

int cmd_mktag(int argc, const char **argv, const char *prefix)
{
	struct object obj;
	struct strbuf buf = STRBUF_INIT;
	struct object_id result;
	struct fsck_options fsck_options = FSCK_OPTIONS_STRICT;

	if (argc != 1)
		usage("git mktag");

	if (strbuf_read(&buf, 0, 0) < 0)
		die_errno("could not read from stdin");

	/*
	 * Fake up an object for fsck_object()
	 */
	obj.parsed = 1;
	obj.type = OBJ_TAG;

	fsck_options.extra = 1;
	fsck_options.error_func = mktag_fsck_error_func;
	if (fsck_object(&obj, buf.buf, buf.len, &fsck_options))
		die("tag on stdin did not pass our strict fsck check");

	if (write_object_file(buf.buf, buf.len, tag_type, &result) < 0)
		die("unable to write annotated tag object");

	strbuf_release(&buf);
	printf("%s\n", oid_to_hex(&result));
	return 0;
}

debug log:

solving e9a0954dcb ...
found e9a0954dcb in https://public-inbox.org/git/20201126012854.399-10-avarab@gmail.com/
found a1ae80702d in https://public-inbox.org/git/20201126012854.399-9-avarab@gmail.com/
found dc354828f7 in https://public-inbox.org/git/20201126222257.5629-5-avarab@gmail.com/ ||
	https://public-inbox.org/git/20201126012854.399-4-avarab@gmail.com/
found 603b55aca0 in https://public-inbox.org/git/20201126222257.5629-4-avarab@gmail.com/ ||
	https://public-inbox.org/git/20201126012854.399-3-avarab@gmail.com/
found ff7ac8e0e5 in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100644 ff7ac8e0e5dbfe77ca16d2304b944a30c14ca408	builtin/mktag.c

applying [1/4] https://public-inbox.org/git/20201126222257.5629-4-avarab@gmail.com/
diff --git a/builtin/mktag.c b/builtin/mktag.c
index ff7ac8e0e5..603b55aca0 100644

Checking patch builtin/mktag.c...
Applied patch builtin/mktag.c cleanly.

skipping https://public-inbox.org/git/20201126012854.399-3-avarab@gmail.com/ for 603b55aca0
index at:
100644 603b55aca0e91d9ed2272cf8ea0ce9a0fdd9dbe5	builtin/mktag.c

applying [2/4] https://public-inbox.org/git/20201126222257.5629-5-avarab@gmail.com/
diff --git a/builtin/mktag.c b/builtin/mktag.c
index 603b55aca0..dc354828f7 100644

Checking patch builtin/mktag.c...
Applied patch builtin/mktag.c cleanly.

skipping https://public-inbox.org/git/20201126012854.399-4-avarab@gmail.com/ for dc354828f7
index at:
100644 dc354828f7d34ac5c66b73479864f254bf1b8157	builtin/mktag.c

applying [3/4] https://public-inbox.org/git/20201126012854.399-9-avarab@gmail.com/
diff --git a/builtin/mktag.c b/builtin/mktag.c
index dc354828f7..a1ae80702d 100644


applying [4/4] https://public-inbox.org/git/20201126012854.399-10-avarab@gmail.com/
diff --git a/builtin/mktag.c b/builtin/mktag.c
index a1ae80702d..e9a0954dcb 100644

Checking patch builtin/mktag.c...
Applied patch builtin/mktag.c cleanly.
Checking patch builtin/mktag.c...
Applied patch builtin/mktag.c cleanly.

index at:
100644 e9a0954dcbf1540314cb6f19ae58e4a824a21c97	builtin/mktag.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).