How do I get the short commit id versus the long one when using PHP for a webhook?How to get first 5 characters from stringHow much of a git sha is *generally* considered necessary to uniquely identify a change in a given codebase?How to disambiguate an ambiguous abbreviated sha1 in gitHow to modify existing, unpushed commit messages?How do I undo 'git add' before commit?How to list all the files in a commit?How to change the author and committer name and e-mail of multiple commits in Git?How do I undo the most recent local commits in Git?How to modify a specified commit?How do I make Git use the editor of my choice for commits?How to change the commit author for one specific commit?How do I revert a Git repository to a previous commit?Message 'src refspec master does not match any' when pushing commits in Git

Find The One Element In An Array That is Different From The Others

Did the Vulgar Latin verb "toccare" exist?

Contexte et orthographe du mot « feedback »

Print the last, middle and first character of your code

Shortest hex dumping program

Why didn't Nick Fury expose the villain's identity and plans?

What does (void *)1 mean

Why does the U.S. tolerate foreign influence from Saudi Arabia and Israel on its domestic policies while not tolerating that from China or Russia?

Does throwing a penny at a train stop the train?

For a hashing function like MD5, how similar can two plaintext strings be and still generate the same hash?

What prevents someone from claiming to be the murderer in order to get the real murderer off?

Is anyone advocating the promotion of homosexuality in UK schools?

How to memorize multiple pieces?

How to md5 a list of filepaths contained in a file?

Is there any word for "disobedience to God"?

Integer Lists of Noah

What's the point of having a RAID 1 configuration over incremental backups to a secondary drive?

Why was hardware diversification an asset for the IBM PC ecosystem?

Credit score and financing new car

Using Newton's shell theorem to accelerate a spaceship

Single word for "refusing to move to next activity unless present one is completed."

How do you move up one folder in Finder?

Is a request to book a business flight ticket for a graduate student an unreasonable one?

Why do people keep referring to Leia as Princess Leia, even after the destruction of Alderaan?



How do I get the short commit id versus the long one when using PHP for a webhook?


How to get first 5 characters from stringHow much of a git sha is *generally* considered necessary to uniquely identify a change in a given codebase?How to disambiguate an ambiguous abbreviated sha1 in gitHow to modify existing, unpushed commit messages?How do I undo 'git add' before commit?How to list all the files in a commit?How to change the author and committer name and e-mail of multiple commits in Git?How do I undo the most recent local commits in Git?How to modify a specified commit?How do I make Git use the editor of my choice for commits?How to change the commit author for one specific commit?How do I revert a Git repository to a previous commit?Message 'src refspec master does not match any' when pushing commits in Git






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








2















So I am using a PHP script to create a webhook with Gitlab. However, I am running into a slight issue. Finding the short commit ID. How would I find this? I can't seem to find it within PHP. Thanks!



The solutions I've seen are using the PHP exec() function which I definitely do not want enabled on my web server.



I expect the commit ID in the webhook to appear as something such as "2e54ar" rather than having the long string of numbers and letters.










share|improve this question




























    2















    So I am using a PHP script to create a webhook with Gitlab. However, I am running into a slight issue. Finding the short commit ID. How would I find this? I can't seem to find it within PHP. Thanks!



    The solutions I've seen are using the PHP exec() function which I definitely do not want enabled on my web server.



    I expect the commit ID in the webhook to appear as something such as "2e54ar" rather than having the long string of numbers and letters.










    share|improve this question
























      2












      2








      2


      1






      So I am using a PHP script to create a webhook with Gitlab. However, I am running into a slight issue. Finding the short commit ID. How would I find this? I can't seem to find it within PHP. Thanks!



      The solutions I've seen are using the PHP exec() function which I definitely do not want enabled on my web server.



      I expect the commit ID in the webhook to appear as something such as "2e54ar" rather than having the long string of numbers and letters.










      share|improve this question














      So I am using a PHP script to create a webhook with Gitlab. However, I am running into a slight issue. Finding the short commit ID. How would I find this? I can't seem to find it within PHP. Thanks!



      The solutions I've seen are using the PHP exec() function which I definitely do not want enabled on my web server.



      I expect the commit ID in the webhook to appear as something such as "2e54ar" rather than having the long string of numbers and letters.







      php git gitlab






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 2:13









      Blizzard098Blizzard098

      111 bronze badge




      111 bronze badge






















          1 Answer
          1






          active

          oldest

          votes


















          0














          By default, a (GitLab or GitHub) webhook would always send a JSON payload including full SHA1 references in it, to avoid any confusion.



          If you want short SHA1 (without executing any command), you could simply use substr






          share|improve this answer























          • Would this commit ID still be valid? (i.e. searchable, etc.)

            – Blizzard098
            Mar 26 at 17:14











          • @Blizzard098 Most often, yes. If not, you can disambiguate it: stackoverflow.com/a/39930978/6309. see also stackoverflow.com/a/21015031/6309.

            – VonC
            Mar 26 at 17:19










          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/3.0/"u003ecc by-sa 3.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%2f55348899%2fhow-do-i-get-the-short-commit-id-versus-the-long-one-when-using-php-for-a-webhoo%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














          By default, a (GitLab or GitHub) webhook would always send a JSON payload including full SHA1 references in it, to avoid any confusion.



          If you want short SHA1 (without executing any command), you could simply use substr






          share|improve this answer























          • Would this commit ID still be valid? (i.e. searchable, etc.)

            – Blizzard098
            Mar 26 at 17:14











          • @Blizzard098 Most often, yes. If not, you can disambiguate it: stackoverflow.com/a/39930978/6309. see also stackoverflow.com/a/21015031/6309.

            – VonC
            Mar 26 at 17:19















          0














          By default, a (GitLab or GitHub) webhook would always send a JSON payload including full SHA1 references in it, to avoid any confusion.



          If you want short SHA1 (without executing any command), you could simply use substr






          share|improve this answer























          • Would this commit ID still be valid? (i.e. searchable, etc.)

            – Blizzard098
            Mar 26 at 17:14











          • @Blizzard098 Most often, yes. If not, you can disambiguate it: stackoverflow.com/a/39930978/6309. see also stackoverflow.com/a/21015031/6309.

            – VonC
            Mar 26 at 17:19













          0












          0








          0







          By default, a (GitLab or GitHub) webhook would always send a JSON payload including full SHA1 references in it, to avoid any confusion.



          If you want short SHA1 (without executing any command), you could simply use substr






          share|improve this answer













          By default, a (GitLab or GitHub) webhook would always send a JSON payload including full SHA1 references in it, to avoid any confusion.



          If you want short SHA1 (without executing any command), you could simply use substr







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 26 at 5:55









          VonCVonC

          876k318 gold badges2832 silver badges3392 bronze badges




          876k318 gold badges2832 silver badges3392 bronze badges












          • Would this commit ID still be valid? (i.e. searchable, etc.)

            – Blizzard098
            Mar 26 at 17:14











          • @Blizzard098 Most often, yes. If not, you can disambiguate it: stackoverflow.com/a/39930978/6309. see also stackoverflow.com/a/21015031/6309.

            – VonC
            Mar 26 at 17:19

















          • Would this commit ID still be valid? (i.e. searchable, etc.)

            – Blizzard098
            Mar 26 at 17:14











          • @Blizzard098 Most often, yes. If not, you can disambiguate it: stackoverflow.com/a/39930978/6309. see also stackoverflow.com/a/21015031/6309.

            – VonC
            Mar 26 at 17:19
















          Would this commit ID still be valid? (i.e. searchable, etc.)

          – Blizzard098
          Mar 26 at 17:14





          Would this commit ID still be valid? (i.e. searchable, etc.)

          – Blizzard098
          Mar 26 at 17:14













          @Blizzard098 Most often, yes. If not, you can disambiguate it: stackoverflow.com/a/39930978/6309. see also stackoverflow.com/a/21015031/6309.

          – VonC
          Mar 26 at 17:19





          @Blizzard098 Most often, yes. If not, you can disambiguate it: stackoverflow.com/a/39930978/6309. see also stackoverflow.com/a/21015031/6309.

          – VonC
          Mar 26 at 17:19








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          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%2f55348899%2fhow-do-i-get-the-short-commit-id-versus-the-long-one-when-using-php-for-a-webhoo%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

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript