Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Issues
  • #10109

Closed
Open
Created Mar 28, 2016 by Administrator@rootOwner

gitlab push webhook can't detect file renames

Created by: pmelopereira

Hi. I wrote a webhook to process push events from GitLab but found that the Json POST request body does not contain anything to distinguish file renames. What we get in the response is: added, modified and removed. Whenever there is a rename in the repository, the webhook gets a new added file.

Is there any way to get more information on the added file, or alternatively get a new 'renamed' attribute in the Json request ?

Git commands: $ git add . -A $ git status On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD ..." to unstage)

    renamed:    folder1/new_file.txt -> folder1/renamed_file.txt

Example Json: { object_kind: 'push', before: '6b2e4965f857c08410b1a94ca59ba7c16dba9bd4', after: '41d319893e68135d156e4a6932649e7cfea05376', ref: 'refs/heads/master', checkout_sha: '41d319893e68135d156e4a6932649e7cfea05376', message: null, user_id: 2, user_name: 'nb20308', user_email: '[email protected] (nb20308%40novabase.pt)', user_avatar: '___http://www.gravatar.com/avatar/8d8e3312ac544ffef2e27703c819a6e6?s=80&d=identicon', project_id: 1, project: { name: 'test', description: '', web_url: '__http://b273ef1ce41a/root/test', avatar_url: null, git_ssh_url: 'git@b273ef1ce41a:root/test.git', git_http_url: '__http://b273ef1ce41a/root/test.git', namespace: 'root', visibility_level: 0, path_with_namespace: 'root/test', default_branch: 'master', homepage: '__http://b273ef1ce41a/root/test', url: 'git@b273ef1ce41a:root/test.git', ssh_url: 'git@b273ef1ce41a:root/test.git', http_url: '__http://b273ef1ce41a/root/test.git' }, commits: [{ id: '41d319893e68135d156e4a6932649e7cfea05376', message: 'renamed test\n', timestamp: '2016-03-28T16:55:29+01:00', url: '__http://b273ef1ce41a/root/test/commit/41d319893e68135d156e4a6932649e7cfea05376', author: [Object], added: [Object], modified: [], removed: [] }], total_commits_count: 1, repository: { name: 'test', url: 'git@b273ef1ce41a:root/test.git', description: '', homepage: '__http://b273ef1ce41a/root/test', git_http_url: '__http://b273ef1ce41a/root/test.git', git_ssh_url: 'git@b273ef1ce41a:root/test.git', visibility_level: 0 } }

Assignee
Assign to
Time tracking