Git describe conditional fatal error in FOR /F commandHow do I discard unstaged changes in Git?How to remove local (untracked) files from the current Git working treeWhat is the difference between 'git pull' and 'git fetch'?How do I undo 'git add' before commit?How do I undo the most recent local commits in Git?How do I force “git pull” to overwrite local files?How do I check out a remote Git branch?How do I delete a Git branch locally and remotely?How do I revert a Git repository to a previous commit?How do I rename a local Git branch?

Are lawyers allowed to come to agreements with opposing lawyers without the client's knowledge or consent?

On the meaning of 'anyways' in "What Exactly Is a Quartz Crystal, Anyways?"

2000s Animated TV show where teenagers could physically go into a virtual world

What Secular Civic Space Would Pioneers Build For Small Frontier Towns?

Organisational search option

A food item only made possible by time-freezing storage?

Hiking with a mule or two?

Is "ln" (natural log) and "log" the same thing if used in this answer?

To what extent is it worthwhile to report check fraud / refund scams?

Is this a Sherman, and if so what model?

Conflict with hidden names

What is the size of a set of sets of the empty set , , ?

Is it impolite to ask for halal food when traveling to and in Thailand?

Magneto 2 How to call Helper function in observer file

Going to France with limited French for a day

Order of ingredients when making Pizza dough

1, 2, 4, 8, 16, ... 33?

Is it really necessary to have a four hour meeting in Sprint planning?

Is there any iPhone SE out there with 3D Touch?

When is it acceptable to write a bad letter of recommendation?

What is the difference between an astronaut in the ISS and a freediver in perfect neutral buoyancy?

practicality of 30 year fix mortgage at 55 years of age

Would Taiwan and China's dispute be solved if Taiwan gave up being the Republic of China?

Can I take NEW (still in their boxes) PC PARTS in my checked in luggage?



Git describe conditional fatal error in FOR /F command


How do I discard unstaged changes in Git?How to remove local (untracked) files from the current Git working treeWhat is the difference between 'git pull' and 'git fetch'?How do I undo 'git add' before commit?How do I undo the most recent local commits in Git?How do I force “git pull” to overwrite local files?How do I check out a remote Git branch?How do I delete a Git branch locally and remotely?How do I revert a Git repository to a previous commit?How do I rename a local Git branch?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















This is a weird one. The code below works as expected inside a batch file:



FOR /F "tokens=1,2,3,* delims=-" %%G IN (
'git describe --long --always --dirty --broken'
) do (
set tag_name=%%G
set versions_from_tag=%%H
set hash=%%I
set dirty_broken=%%J
)


When I try to add the --abbrev option I get a fatal error:



FOR /F "tokens=1,2,3,* delims=-" %%G IN (
'git describe --long --always --dirty --broken --abbrev=8'
) do (
set tag_name=%%G
set versions_from_tag=%%H
set hash=%%I
set dirty_broken=%%J
)


outputs:fatal: --dirty is incompatible with commit-ishes



but if I run the command outside of the FOR /F it works as expected:



git describe --long --always --dirty --broken --abbrev=8


outputs 2.11-13-ga03306e6-dirty



I'm assuming this probably has something to do with the environment of the FOR /F command?










share|improve this question



















  • 2





    try to escape equal sign, … --abbrev^=8' see

    – elzooilogico
    Mar 28 at 16:44












  • see robvanderwoude.com/escapechars.php

    – elzooilogico
    Mar 28 at 16:50











  • @elzooilogico yep that was it. feel free to answer. If not I'll write it up.

    – Rick
    Mar 28 at 18:39

















1















This is a weird one. The code below works as expected inside a batch file:



FOR /F "tokens=1,2,3,* delims=-" %%G IN (
'git describe --long --always --dirty --broken'
) do (
set tag_name=%%G
set versions_from_tag=%%H
set hash=%%I
set dirty_broken=%%J
)


When I try to add the --abbrev option I get a fatal error:



FOR /F "tokens=1,2,3,* delims=-" %%G IN (
'git describe --long --always --dirty --broken --abbrev=8'
) do (
set tag_name=%%G
set versions_from_tag=%%H
set hash=%%I
set dirty_broken=%%J
)


outputs:fatal: --dirty is incompatible with commit-ishes



but if I run the command outside of the FOR /F it works as expected:



git describe --long --always --dirty --broken --abbrev=8


outputs 2.11-13-ga03306e6-dirty



I'm assuming this probably has something to do with the environment of the FOR /F command?










share|improve this question



















  • 2





    try to escape equal sign, … --abbrev^=8' see

    – elzooilogico
    Mar 28 at 16:44












  • see robvanderwoude.com/escapechars.php

    – elzooilogico
    Mar 28 at 16:50











  • @elzooilogico yep that was it. feel free to answer. If not I'll write it up.

    – Rick
    Mar 28 at 18:39













1












1








1








This is a weird one. The code below works as expected inside a batch file:



FOR /F "tokens=1,2,3,* delims=-" %%G IN (
'git describe --long --always --dirty --broken'
) do (
set tag_name=%%G
set versions_from_tag=%%H
set hash=%%I
set dirty_broken=%%J
)


When I try to add the --abbrev option I get a fatal error:



FOR /F "tokens=1,2,3,* delims=-" %%G IN (
'git describe --long --always --dirty --broken --abbrev=8'
) do (
set tag_name=%%G
set versions_from_tag=%%H
set hash=%%I
set dirty_broken=%%J
)


outputs:fatal: --dirty is incompatible with commit-ishes



but if I run the command outside of the FOR /F it works as expected:



git describe --long --always --dirty --broken --abbrev=8


outputs 2.11-13-ga03306e6-dirty



I'm assuming this probably has something to do with the environment of the FOR /F command?










share|improve this question














This is a weird one. The code below works as expected inside a batch file:



FOR /F "tokens=1,2,3,* delims=-" %%G IN (
'git describe --long --always --dirty --broken'
) do (
set tag_name=%%G
set versions_from_tag=%%H
set hash=%%I
set dirty_broken=%%J
)


When I try to add the --abbrev option I get a fatal error:



FOR /F "tokens=1,2,3,* delims=-" %%G IN (
'git describe --long --always --dirty --broken --abbrev=8'
) do (
set tag_name=%%G
set versions_from_tag=%%H
set hash=%%I
set dirty_broken=%%J
)


outputs:fatal: --dirty is incompatible with commit-ishes



but if I run the command outside of the FOR /F it works as expected:



git describe --long --always --dirty --broken --abbrev=8


outputs 2.11-13-ga03306e6-dirty



I'm assuming this probably has something to do with the environment of the FOR /F command?







git batch-file git-describe






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 16:14









RickRick

8748 silver badges17 bronze badges




8748 silver badges17 bronze badges










  • 2





    try to escape equal sign, … --abbrev^=8' see

    – elzooilogico
    Mar 28 at 16:44












  • see robvanderwoude.com/escapechars.php

    – elzooilogico
    Mar 28 at 16:50











  • @elzooilogico yep that was it. feel free to answer. If not I'll write it up.

    – Rick
    Mar 28 at 18:39












  • 2





    try to escape equal sign, … --abbrev^=8' see

    – elzooilogico
    Mar 28 at 16:44












  • see robvanderwoude.com/escapechars.php

    – elzooilogico
    Mar 28 at 16:50











  • @elzooilogico yep that was it. feel free to answer. If not I'll write it up.

    – Rick
    Mar 28 at 18:39







2




2





try to escape equal sign, … --abbrev^=8' see

– elzooilogico
Mar 28 at 16:44






try to escape equal sign, … --abbrev^=8' see

– elzooilogico
Mar 28 at 16:44














see robvanderwoude.com/escapechars.php

– elzooilogico
Mar 28 at 16:50





see robvanderwoude.com/escapechars.php

– elzooilogico
Mar 28 at 16:50













@elzooilogico yep that was it. feel free to answer. If not I'll write it up.

– Rick
Mar 28 at 18:39





@elzooilogico yep that was it. feel free to answer. If not I'll write it up.

– Rick
Mar 28 at 18:39












1 Answer
1






active

oldest

votes


















0
















Thanks to elzooilogico.



As detailed here, the = needs to be escaped like ^= when used in the subject of the FOR /F command.



Without the escape I think the 8 was being treated as the commit-ish string.



FOR /F "tokens=1,2,3,* delims=-" %%G IN (
'git describe --long --always --dirty --broken --abbrev^=8'
) do (
set tag_name=%%G
set versions_from_tag=%%H
set hash=%%I00
set dirty_broken=%%J
)


Worked as expected.






share|improve this answer



























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55402342%2fgit-describe-conditional-fatal-error-in-for-f-command%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0
















    Thanks to elzooilogico.



    As detailed here, the = needs to be escaped like ^= when used in the subject of the FOR /F command.



    Without the escape I think the 8 was being treated as the commit-ish string.



    FOR /F "tokens=1,2,3,* delims=-" %%G IN (
    'git describe --long --always --dirty --broken --abbrev^=8'
    ) do (
    set tag_name=%%G
    set versions_from_tag=%%H
    set hash=%%I00
    set dirty_broken=%%J
    )


    Worked as expected.






    share|improve this answer





























      0
















      Thanks to elzooilogico.



      As detailed here, the = needs to be escaped like ^= when used in the subject of the FOR /F command.



      Without the escape I think the 8 was being treated as the commit-ish string.



      FOR /F "tokens=1,2,3,* delims=-" %%G IN (
      'git describe --long --always --dirty --broken --abbrev^=8'
      ) do (
      set tag_name=%%G
      set versions_from_tag=%%H
      set hash=%%I00
      set dirty_broken=%%J
      )


      Worked as expected.






      share|improve this answer



























        0














        0










        0









        Thanks to elzooilogico.



        As detailed here, the = needs to be escaped like ^= when used in the subject of the FOR /F command.



        Without the escape I think the 8 was being treated as the commit-ish string.



        FOR /F "tokens=1,2,3,* delims=-" %%G IN (
        'git describe --long --always --dirty --broken --abbrev^=8'
        ) do (
        set tag_name=%%G
        set versions_from_tag=%%H
        set hash=%%I00
        set dirty_broken=%%J
        )


        Worked as expected.






        share|improve this answer













        Thanks to elzooilogico.



        As detailed here, the = needs to be escaped like ^= when used in the subject of the FOR /F command.



        Without the escape I think the 8 was being treated as the commit-ish string.



        FOR /F "tokens=1,2,3,* delims=-" %%G IN (
        'git describe --long --always --dirty --broken --abbrev^=8'
        ) do (
        set tag_name=%%G
        set versions_from_tag=%%H
        set hash=%%I00
        set dirty_broken=%%J
        )


        Worked as expected.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 29 at 12:58









        RickRick

        8748 silver badges17 bronze badges




        8748 silver badges17 bronze badges

































            draft saved

            draft discarded















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55402342%2fgit-describe-conditional-fatal-error-in-for-f-command%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

            밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

            1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴