# Is git mktag supposed to accept git cat-file input?

4 messages from 2012-10-24 to 2012-10-25. Participants: Anand Kumria, Brandon Casey, Michael J Gruber.
Thread: https://gitlist.dev/t/31935

## Anand Kumria, 2012-10-24 23:39

Subject: Is git mktag supposed to accept git cat-file input?
Message-ID: <CAM1C4GneOnyBQyJRbhtuYNDsc4NxXgFcfHrQpziLpp_AY0TjbA@mail.gmail.com>
URL: https://gitlist.dev/e/CAM1C4GneOnyBQyJRbhtuYNDsc4NxXgFcfHrQpziLpp_AY0TjbA%40mail.gmail.com

```
Hi,

I am doing some experimenting with git-mktag, and was looking into the
format it expects on input.

Should this sequence of commands work?

kalki:[~]% mkdir /tmp/gittest; cd /tmp/gittest
kalki:[/tmp/gittest]% git init
Initialized empty Git repository in /tmp/gittest/.git/
kalki:[/tmp/gittest]% echo "test" > test
kalki:[/tmp/gittest]% git add test
kalki:[/tmp/gittest]% git commit -m "commit-test"
[master (root-commit) c0ae36f] commit-test
 1 file changed, 1 insertion(+)
 create mode 100644 test
kalki:[/tmp/gittest]% git tag -m "tag-test" tag-test
kalki:[/tmp/gittest]% git cat-file -p e619
object c0ae36fee730f7034b1f76c1490fe6f46f7ecad5
type commit
tag tag-test
tagger Anand Kumria <akumria@acm.org> Thu Oct 25 00:32:32 2012 +0100

tag-test
kalki:[/tmp/gittest]% git cat-file -p e619 | sed
-e's/tag-test/tag-test2/' > tag-test2
kalki:[/tmp/gittest]% cat tag-test2
object c0ae36fee730f7034b1f76c1490fe6f46f7ecad5
type commit
tag tag-test2
tagger Anand Kumria <akumria@acm.org> Thu Oct 25 00:32:32 2012 +0100

tag-test2
kalki:[/tmp/gittest]% git mktag < tag-test2
error: char112: missing tag timestamp
fatal: invalid tag signature file
kalki:[/tmp/gittest]% git --version
git version 1.7.9.5

The error message related to the timezone / timestamp being incorrect
but I can't see what the problem is.

Any advice appreciated.

Please CC me as I may miss your reply.

Thanks,
Anand

--
“Don’t be sad because it’s over. Smile because it happened.” – Dr. Seuss

```

## Brandon Casey, 2012-10-25 00:18

Subject: Re: Is git mktag supposed to accept git cat-file input?
Message-ID: <CA+sFfMdaaTwc82-J6a=wdjDzAFq6z8PS2rjSZ=tuyweOzuf4Kg@mail.gmail.com>
URL: https://gitlist.dev/e/CA%2BsFfMdaaTwc82-J6a%3DwdjDzAFq6z8PS2rjSZ%3DtuyweOzuf4Kg%40mail.gmail.com
In-Reply-To: <CAM1C4GneOnyBQyJRbhtuYNDsc4NxXgFcfHrQpziLpp_AY0TjbA@mail.gmail.com>

```
On Wed, Oct 24, 2012 at 4:39 PM, Anand Kumria <akumria@acm.org> wrote:
> Hi,
>
> I am doing some experimenting with git-mktag, and was looking into the
> format it expects on input.
>
> Should this sequence of commands work?

Yes, with a slight tweak...

> kalki:[/tmp/gittest]% git tag -m "tag-test" tag-test
> kalki:[/tmp/gittest]% git cat-file -p e619

'-p' means pretty-print, i.e. produce a human-readable format.  mktag
supports the raw format.  So you should invoke it like this:

      $ git cat-file tag e619

which should produce something like:

   object c0ae36fee730f7034b1f76c1490fe6f46f7ecad5
   type commit
   tag tag-test
   tagger Anand Kumria <akumria@acm.org> 1351121552 +0100

   tag-test

and is the format expected by mktag.

-Brandon

```

## Anand Kumria, 2012-10-25 00:58

Subject: Re: Is git mktag supposed to accept git cat-file input?
Message-ID: <CAM1C4Gn6tr_bxG1De+kZecpJ7kLg7_hOO7q-aa7HwFkr9od6_Q@mail.gmail.com>
URL: https://gitlist.dev/e/CAM1C4Gn6tr_bxG1De%2BkZecpJ7kLg7_hOO7q-aa7HwFkr9od6_Q%40mail.gmail.com
In-Reply-To: <CA+sFfMdaaTwc82-J6a=wdjDzAFq6z8PS2rjSZ=tuyweOzuf4Kg@mail.gmail.com>

```
Ahh, unix time. Of course.

Thanks Brandon.

On 25 October 2012 01:18, Brandon Casey <drafnel@gmail.com> wrote:
> On Wed, Oct 24, 2012 at 4:39 PM, Anand Kumria <akumria@acm.org> wrote:
>> Hi,
>>
>> I am doing some experimenting with git-mktag, and was looking into the
>> format it expects on input.
>>
>> Should this sequence of commands work?
>
> Yes, with a slight tweak...
>
>> kalki:[/tmp/gittest]% git tag -m "tag-test" tag-test
>> kalki:[/tmp/gittest]% git cat-file -p e619
>
> '-p' means pretty-print, i.e. produce a human-readable format.  mktag
> supports the raw format.  So you should invoke it like this:
>
>       $ git cat-file tag e619
>
> which should produce something like:
>
>    object c0ae36fee730f7034b1f76c1490fe6f46f7ecad5
>    type commit
>    tag tag-test
>    tagger Anand Kumria <akumria@acm.org> 1351121552 +0100
>
>    tag-test
>
> and is the format expected by mktag.
>
> -Brandon
>



-- 
“Don’t be sad because it’s over. Smile because it happened.” – Dr. Seuss

```

## Michael J Gruber, 2012-10-25 08:34

Subject: Re: Is git mktag supposed to accept git cat-file input?
Message-ID: <5088F9AB.8090203@drmicha.warpmail.net>
URL: https://gitlist.dev/e/5088F9AB.8090203%40drmicha.warpmail.net
In-Reply-To: <CAM1C4Gn6tr_bxG1De+kZecpJ7kLg7_hOO7q-aa7HwFkr9od6_Q@mail.gmail.com>

```
Anand Kumria venit, vidit, dixit 25.10.2012 02:58:
> Ahh, unix time. Of course.

That's the only difference *at the time being*, but this is not
guaranteed. Really, as Brandon says: "cat-file -p" is pretty printing
for human readability (which could be improved), and "cat-file <type>"
is the raw format which is the content being hashed to the sha1.

> 
> Thanks Brandon.
> 
> On 25 October 2012 01:18, Brandon Casey <drafnel@gmail.com> wrote:
>> On Wed, Oct 24, 2012 at 4:39 PM, Anand Kumria <akumria@acm.org> wrote:
>>> Hi,
>>>
>>> I am doing some experimenting with git-mktag, and was looking into the
>>> format it expects on input.
>>>
>>> Should this sequence of commands work?
>>
>> Yes, with a slight tweak...
>>
>>> kalki:[/tmp/gittest]% git tag -m "tag-test" tag-test
>>> kalki:[/tmp/gittest]% git cat-file -p e619
>>
>> '-p' means pretty-print, i.e. produce a human-readable format.  mktag
>> supports the raw format.  So you should invoke it like this:
>>
>>       $ git cat-file tag e619
>>
>> which should produce something like:
>>
>>    object c0ae36fee730f7034b1f76c1490fe6f46f7ecad5
>>    type commit
>>    tag tag-test
>>    tagger Anand Kumria <akumria@acm.org> 1351121552 +0100
>>
>>    tag-test
>>
>> and is the format expected by mktag.
>>
>> -Brandon
>>
> 
> 
> 

```
