]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-tag.c
Support gitlinks in fast-import.
[git.git] / builtin-tag.c
index 73cb7bfc857eaad8e7902a2be8cd81c8093eb18d..c2cca6cb6dc46a221c65092d7c419445d6442b5f 100644 (file)
@@ -202,6 +202,7 @@ static int do_sign(struct strbuf *buffer)
        const char *args[4];
        char *bracket;
        int len;
+       int i, j;
 
        if (!*signingkey) {
                if (strlcpy(signingkey, git_committer_info(IDENT_ERROR_ON_NO_NAME),
@@ -241,6 +242,15 @@ static int do_sign(struct strbuf *buffer)
        if (finish_command(&gpg) || !len || len < 0)
                return error("gpg failed to sign the tag");
 
+       /* Strip CR from the line endings, in case we are on Windows. */
+       for (i = j = 0; i < buffer->len; i++)
+               if (buffer->buf[i] != '\r') {
+                       if (i != j)
+                               buffer->buf[j] = buffer->buf[i];
+                       j++;
+               }
+       strbuf_setlen(buffer, j);
+
        return 0;
 }